com.sun.mirror.declaration.Declaration类的使用及代码示例

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

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

Declaration介绍

暂无

代码示例

代码示例来源: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.codehaus.enunciate/enunciate-core

/**
 * Whether a declaration is xml transient.
 *
 * @param declaration The declaration on which to determine xml transience.
 * @return Whether a declaration is xml transient.
 */
protected boolean isXmlTransient(Declaration declaration) {
 return (declaration.getAnnotation(XmlTransient.class) != null);
}

代码示例来源:origin: stackoverflow.com

Collection<AnnotationMirror> ams = d.getAnnotationMirrors();
for (AnnotationMirror am : ams) {
  if (am.getAnnotationType().getDeclaration().equals(atd)) {

代码示例来源: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.codehaus.enunciate/enunciate-core

XmlJavaTypeAdapter typeAdapterInfo = referer != null ? referer.getAnnotation(XmlJavaTypeAdapter.class) : null;
if (adaptedType instanceof DeclaredType) {
 if (typeAdapterInfo == null) {
 throw new ValidationException(referer.getPosition(), referer.getSimpleName() + ": adapter " + adapterTypeMirror.getDeclaration().getQualifiedName() + " does not adapt " + unwrappedAdaptedType);

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

Set<Facet> bucket = new TreeSet<Facet>();
if (declaration != null) {
 org.codehaus.enunciate.Facet facet = declaration.getAnnotation(org.codehaus.enunciate.Facet.class);
 if (facet != null) {
  bucket.add(new Facet(facet, declaration.getSimpleName()));
 Facets facets = declaration.getAnnotation(Facets.class);
 if (facets != null) {
  for (org.codehaus.enunciate.Facet f : facets.value()) {
   bucket.add(new Facet(f, declaration.getSimpleName()));
 Collection<AnnotationMirror> annotationMirrors = declaration.getAnnotationMirrors();
 for (AnnotationMirror annotationMirror : annotationMirrors) {
  AnnotationType annotationType = annotationMirror.getAnnotationType();

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

/**
 * Gets all the annotations on the given declaration.
 */
private Annotation[] getAllAnnotations(Declaration decl, Locatable srcPos) {
  List<Annotation> r = new ArrayList<Annotation>();
  for( AnnotationMirror m : decl.getAnnotationMirrors() ) {
    try {
      String fullName = m.getAnnotationType().getDeclaration().getQualifiedName();
      Class<? extends Annotation> type =
        getClass().getClassLoader().loadClass(fullName).asSubclass(Annotation.class);
      Annotation annotation = decl.getAnnotation(type);
      if(annotation!=null)
        r.add( LocatableAnnotation.create(annotation,srcPos) );
    } catch (ClassNotFoundException e) {
      // just continue
    }
  }
  return r.toArray(EMPTY_ANNOTATION);
}

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

private void gatherDocumentationGroupFacets(Declaration decl, Set<Facet> facets) {
 if (decl != null) {
  DocumentationGroup documentationGroup = decl.getAnnotation(DocumentationGroup.class);
  if (documentationGroup != null) {
   for (String name : documentationGroup.value()) {
    facets.add(new Facet(DocumentationGroup.class.getName(), name, new JavaDoc(decl.getDocComment()).toString()));
   }
  }
  else if (decl instanceof TypeDeclaration) {
   PackageDeclaration pkg = ((TypeDeclaration)decl).getPackage();
   if (pkg != null) {
    documentationGroup = pkg.getAnnotation(DocumentationGroup.class);
    if (documentationGroup != null) {
     for (String name : documentationGroup.value()) {
      facets.add(new Facet(DocumentationGroup.class.getName(), name, new JavaDoc(pkg.getDocComment()).toString()));
     }
    }
   }
  }
 }
}

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

/**
 * Decorates a collection of declarations.
 *
 * @param declarations The declarations to decorate.
 * @return The decorated declarations.
 */
@SuppressWarnings({"unchecked"})
public static <D extends Declaration> Collection<D> decorate(Collection<D> declarations) {
 if (declarations == null) {
  return null;
 }
 DeclarationDecorator decorator = getInstance();
 ArrayList<D> decls = new ArrayList<D>(declarations.size());
 for (D declaration : declarations) {
  declaration.accept(decorator);
  decls.add((D) decorator.getDecoratedDeclaration());
 }
 return decls;
}

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

public String getDocComment() {
 return delegate.getDocComment();
}

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

public Collection<Modifier> getModifiers() {
 return delegate.getModifiers();
}

代码示例来源:origin: org.apache.vysper/spec-compliance

public String getMember() {
  if (declaration instanceof FieldDeclaration || declaration instanceof MethodDeclaration) {
    MemberDeclaration memberDeclaration = (MemberDeclaration) declaration;
    return declaration.getSimpleName();
  } else {
    return null;
  }
}

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

WebService ws = delegate.getAnnotation(WebService.class);
if (ws == null) {
 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-core

MatrixParam matrixParam = declaration.getAnnotation(MatrixParam.class);
if (matrixParam != null) {
 parameterName = matrixParam.value();
QueryParam queryParam = declaration.getAnnotation(QueryParam.class);
if (queryParam != null) {
 parameterName = queryParam.value();
PathParam pathParam = declaration.getAnnotation(PathParam.class);
if (pathParam != null) {
 parameterName = pathParam.value();
CookieParam cookieParam = declaration.getAnnotation(CookieParam.class);
if (cookieParam != null) {
 parameterName = cookieParam.value();
HeaderParam headerParam = declaration.getAnnotation(HeaderParam.class);
if (headerParam != null) {
 parameterName = headerParam.value();
FormParam formParam = declaration.getAnnotation(FormParam.class);
if (formParam != null) {
 parameterName = formParam.value();
 for (AnnotationMirror annotation : declaration.getAnnotationMirrors()) {
  AnnotationTypeDeclaration decl = annotation.getAnnotationType().getDeclaration();
  if (decl != null) {
   EnunciateConfiguration config = ((EnunciateFreemarkerModel) FreemarkerModel.get()).getEnunciateConfig();

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

/**
 * Gets all the annotations on the given declaration.
 */
private Annotation[] getAllAnnotations(Declaration decl, Locatable srcPos) {
  List<Annotation> r = new ArrayList<Annotation>();
  for( AnnotationMirror m : decl.getAnnotationMirrors() ) {
    try {
      String fullName = m.getAnnotationType().getDeclaration().getQualifiedName();
      Class<? extends Annotation> type =
        getClass().getClassLoader().loadClass(fullName).asSubclass(Annotation.class);
      Annotation annotation = decl.getAnnotation(type);
      if(annotation!=null)
        r.add( LocatableAnnotation.create(annotation,srcPos) );
    } catch (ClassNotFoundException e) {
      // just continue
    }
  }
  return r.toArray(EMPTY_ANNOTATION);
}

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

/**
 * Decorates a declaration.
 *
 * @param declaration The declaration to decorate.
 * @return The decorated declaration.
 */
@SuppressWarnings({"unchecked"})
public static <D extends Declaration> D decorate(D declaration) {
 if (declaration == null) {
  return null;
 }
 DeclarationDecorator decorator = getInstance();
 declaration.accept(decorator);
 return (D) decorator.getDecoratedDeclaration();
}

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

/**
 * The doc comment associated with this web param.
 *
 * @return The doc comment associated with this web param.
 */
public String getElementDocs() {
 return getDelegate().getDocComment();
}

代码示例来源:origin: com.cedarsoft.commons/codegen

public static boolean isStatic( @Nonnull Declaration fieldDeclaration ) {
 for ( Modifier modifier : fieldDeclaration.getModifiers() ) {
  if ( modifier == Modifier.STATIC ) {
   return true;
  }
 }
 return false;
}

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

public String getSimpleName() {
 return delegate.getSimpleName();
}

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

/**
 * Whether a declaration is xml transient.
 *
 * @param declaration The declaration on which to determine xml transience.
 * @return Whether a declaration is xml transient.
 */
protected boolean isXmlTransient(Declaration declaration) {
 return (declaration.getAnnotation(XmlTransient.class) != null);
}

相关文章