com.sun.mirror.declaration.Declaration.getPosition()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(151)

本文整理了Java中com.sun.mirror.declaration.Declaration.getPosition()方法的一些代码示例,展示了Declaration.getPosition()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Declaration.getPosition()方法的具体详情如下:
包路径:com.sun.mirror.declaration.Declaration
类名称:Declaration
方法名:getPosition

Declaration.getPosition介绍

暂无

代码示例

代码示例来源:origin: sun-jaxb/jaxb-xjc

/**
 * Gets the source location that can be used to report error messages regarding
 * this reference.
 */
public SourcePosition getPosition() {
  return annotations.getPosition();
}

代码示例来源:origin: org.andromda.thirdparty.jaxb2_commons/jaxb-xjc

/**
 * Gets the source location that can be used to report error messages regarding
 * this reference.
 */
public SourcePosition getPosition() {
  return annotations.getPosition();
}

代码示例来源:origin: net.sf.apt-jelly/apt-jelly-core

public SourcePosition getPosition() {
 return delegate.getPosition();
}

代码示例来源:origin: sun-jaxb/jaxb-xjc

private <A extends Declaration> List<A> sort(List<A> l) {
  if(l.isEmpty())     return l;
  // APT supports the operation mode where it creates Declarations from
  // a class file, in which case the source position is not available
  // use that as a key to sort them correctly. This isn't "correct" in
  // the sense that it relies on undocumented behavior of APT where
  // it returns declarations in the reverse order, but this makes things work.
  SourcePosition pos = l.get(0).getPosition();
  if(pos!=null)
    Collections.sort(l,SOURCE_POS_COMPARATOR);
  else
    Collections.reverse(l);
  return l;
}

代码示例来源:origin: org.andromda.thirdparty.jaxb2_commons/jaxb-xjc

private <A extends Declaration> List<A> sort(List<A> l) {
  if(l.isEmpty())     return l;
  // APT supports the operation mode where it creates Declarations from
  // a class file, in which case the source position is not available
  // use that as a key to sort them correctly. This isn't "correct" in
  // the sense that it relies on undocumented behavior of APT where
  // it returns declarations in the reverse order, but this makes things work.
  SourcePosition pos = l.get(0).getPosition();
  if(pos!=null)
    Collections.sort(l,SOURCE_POS_COMPARATOR);
  else
    Collections.reverse(l);
  return l;
}

代码示例来源:origin: org.codehaus.enunciate/enunciate-core

/**
 * Add n warning message.
 *
 * @param declaration The position of the warning.
 * @param text     The text of the warning message.
 */
public void addWarning(Declaration declaration, String text) {
 if (declaration == null) {
  this.errors.add(new ValidationMessage(null, text));
 }
 else if (declaration.getPosition() != null) {
  this.warnings.add(new ValidationMessage(declaration.getPosition(), text));
 }
 else {
  this.warnings.add(new ValidationMessage(null, toString(declaration) + ": " + text));
 }
}

代码示例来源:origin: org.codehaus.enunciate/enunciate-full

public ValidationResult validateEndpointImplementation(EndpointImplementation impl) {
 ValidationResult result = new ValidationResult();
 Declaration delegate = impl.getDelegate();
 WebService ws = delegate.getAnnotation(WebService.class);
 if (ws == null) {
  result.addError(delegate.getPosition(), "Not an endpoint implementation (no WebService annotation).");
 }
 if (delegate instanceof EnumDeclaration) {
  result.addError(delegate.getPosition(), "An enum cannot be an endpoint implementation.");
 }
 if (!isAssignable((TypeDeclaration) delegate, (TypeDeclaration) impl.getEndpointInterface().getDelegate())) {
  result.addError(delegate.getPosition(), "Class does not implement its endpoint interface!");
 }
 return result;
}

代码示例来源:origin: org.andromda.thirdparty.jaxb2_commons/jaxb-xjc

return 0;
SourcePosition p1 = d1.getPosition();
SourcePosition p2 = d2.getPosition();

代码示例来源:origin: sun-jaxb/jaxb-xjc

return 0;
SourcePosition p1 = d1.getPosition();
SourcePosition p2 = d2.getPosition();

代码示例来源:origin: org.codehaus.enunciate/enunciate-core

/**
 * Add an error message.
 *
 * @param declaration The position of the error.
 * @param text     The text of the error message.
 */
public void addError(Declaration declaration, String text) {
 if (declaration == null) {
  this.errors.add(new ValidationMessage(null, text));
 }
 else {
  if (declaration instanceof TypeDefinition) {
   //type definitions get extra context.
   text = appendReferenceInformation(text, ((TypeDefinition)declaration).getReferencedFrom());
  }
  else if (declaration instanceof Accessor) {
   //accessors get extra context.
   text = appendReferenceInformation(text, ((Accessor)declaration).getReferencedFrom());
  }
  if (declaration.getPosition() != null) {
   this.errors.add(new ValidationMessage(declaration.getPosition(), text));
  }
  else {
   this.errors.add(new ValidationMessage(null, toString(declaration) + ": " + text));
  }
 }
}

代码示例来源:origin: com.google.gdata/gdata-core-1.0

msg.printError(decl.getPosition(),
  "@Kind.Term may only be used to annotate a class");
continue;

代码示例来源:origin: com.google.gdata/gdata-java-client

msg.printError(decl.getPosition(),
  "@Kind.Term may only be used to annotate a class");
continue;

代码示例来源:origin: com.mulesoft.google/google-api-gdata

msg.printError(decl.getPosition(),
  "@Kind.Term may only be used to annotate a class");
continue;

代码示例来源:origin: org.codehaus.enunciate/enunciate-full

result.addError(delegate.getPosition(), "Not an endpoint interface: no WebService annotation");
 result.addError(delegate.getPosition(), "An endpoint interface in no package must specify a target namespace.");
 result.addError(delegate.getPosition(), "Not an endpoint interface (it references another endpoint interface).");
result.addError(delegate.getPosition(), "Annotation types are not valid endpoint interfaces.");
result.addError(delegate.getPosition(), "Enums cannot be endpoint interfaces.");

代码示例来源:origin: org.codehaus.enunciate/enunciate-csharp

if (conflict != null) {
  result.addError(webParam, "C# requires that all header parameters defined in the same endpoint interface have unique names. " +
   "This parameter conflicts with the one at " + (conflict.getPosition() == null ? "(unknown source position)" : conflict.getPosition()));
if (conflict != null) {
 result.addError(webMethod, "C# requires that all header parameters defined in the same endpoint interface have unique names. " +
  "This parameter conflicts with the one at " + (conflict.getPosition() == null ? "(unknown source position)" : conflict.getPosition()));

代码示例来源:origin: org.codehaus.enunciate/enunciate-full

throw new ValidationException(referer.getPosition(), "Adapter " + adapterTypeMirror.getDeclaration().getQualifiedName() + " does not adapt " + adaptedType);
throw new ValidationException(referer.getPosition(), "An XML adapter can only adapt a declared type (" + adaptedType + " cannot be adapted).");

代码示例来源:origin: org.codehaus.enunciate/enunciate-core

throw new ValidationException(referer.getPosition(), referer.getSimpleName() + ": adapter " + adapterTypeMirror.getDeclaration().getQualifiedName() + " does not adapt " + unwrappedAdaptedType);

相关文章