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

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

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

Declaration.getAnnotation介绍

暂无

代码示例

代码示例来源: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: 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-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);
}

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

public static boolean isSystemParameter(Declaration candidate) {
 for (AnnotationMirror annotation : candidate.getAnnotationMirrors()) {
  AnnotationTypeDeclaration declaration = annotation.getAnnotationType().getDeclaration();
  if (declaration != null) {
   String fqn = declaration.getQualifiedName();
   if (Context.class.getName().equals(fqn) && candidate.getAnnotation(TypeHint.class) == null) {
    return true;
   }
   EnunciateConfiguration config = ((EnunciateFreemarkerModel) FreemarkerModel.get()).getEnunciateConfig();
   if (config != null && config.getSystemResourceParameterAnnotations().contains(fqn)) {
    return true;
   }
  }
 }
 return false;
}

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

/**
 * Whether the given type declaration is GWT-transient.
 *
 * @param declaration The type declaration.
 * @return Whether the given tyep declaration is GWT-transient.
 */
protected boolean isGWTTransient(Declaration declaration) {
 return declaration != null && declaration.getAnnotation(GWTTransient.class) != null;
}

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

/**
 * Whether the given type declaration is GWT-transient.
 *
 * @param declaration The type declaration.
 * @return Whether the given tyep declaration is GWT-transient.
 */
protected boolean isGWTTransient(Declaration declaration) {
 return declaration != null && declaration.getAnnotation(GWTTransient.class) != null;
}

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

/**
 * Whether the given type declaration is AMF-transient.
 *
 * @param declaration The type declaration.
 * @return Whether the given tyep declaration is AMF-transient.
 */
protected boolean isAMFTransient(Declaration declaration) {
 return declaration != null && declaration.getAnnotation(AMFTransient.class) != null;
}

代码示例来源: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);
}

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

/**
 * Whether the given type declaration is AMF-transient.
 *
 * @param declaration The type declaration.
 * @return Whether the given tyep declaration is AMF-transient.
 */
protected boolean isAMFTransient(Declaration declaration) {
 return declaration != null && declaration.getAnnotation(AMFTransient.class) != null;
}

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

/**
 * Whether the given type declaration is GWT-transient.
 *
 * @param declaration The type declaration.
 * @return Whether the given tyep declaration is GWT-transient.
 */
protected boolean isGWTTransient(Declaration declaration) {
 return declaration != null && declaration.getAnnotation(GWTTransient.class) != null;
}

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

/**
 * Whether the given type declaration is GWT-transient.
 *
 * @param declaration The type declaration.
 * @return Whether the given tyep declaration is GWT-transient.
 */
protected boolean isGWTTransient(Declaration declaration) {
 return declaration != null && declaration.getAnnotation(GWTTransient.class) != null;
}

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

/**
 * Whether the given type declaration is AMF-transient.
 *
 * @param declaration The type declaration.
 * @return Whether the given tyep declaration is AMF-transient.
 */
protected boolean isAMFTransient(Declaration declaration) {
 return declaration != null && declaration.getAnnotation(AMFTransient.class) != null;
}

代码示例来源: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);
 }
}

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

/**
 * Whether the specified declaration is suppliable by JAX-RS.
 *
 * @param declaration The declaration.
 * @return Whether the specified declaration is suppliable by JAX-RS.
 */
protected boolean isSuppliableByJAXRS(Declaration declaration) {
 return (declaration.getAnnotation(MatrixParam.class) != null)
   || (declaration.getAnnotation(PathParam.class) != null)
   || (declaration.getAnnotation(QueryParam.class) != null)
   || (declaration.getAnnotation(CookieParam.class) != null)
   || (declaration.getAnnotation(HeaderParam.class) != null)
   || (declaration.getAnnotation(javax.ws.rs.core.Context.class) != null);
}

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

private NonElement<TypeMirror,TypeDeclaration> getXmlType(Reference r) {
  if(r==null)
    throw new IllegalArgumentException();
  XmlJavaTypeAdapter xjta = r.annotations.getAnnotation(XmlJavaTypeAdapter.class);
  XmlList xl = r.annotations.getAnnotation(XmlList.class);
  Ref<TypeMirror, TypeDeclaration> ref = new Ref<TypeMirror, TypeDeclaration>(
    reader,types.getNavigator(),r.type,xjta,xl);
  return types.getTypeInfo(ref);
}

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

private NonElement<TypeMirror,TypeDeclaration> getXmlType(Reference r) {
  if(r==null)
    throw new IllegalArgumentException();
  XmlJavaTypeAdapter xjta = r.annotations.getAnnotation(XmlJavaTypeAdapter.class);
  XmlList xl = r.annotations.getAnnotation(XmlList.class);
  Ref<TypeMirror, TypeDeclaration> ref = new Ref<TypeMirror, TypeDeclaration>(
    reader,types.getNavigator(),r.type,xjta,xl);
  return types.getTypeInfo(ref);
}

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

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, "Not an endpoint implementation (no WebService annotation).");
 }
 if (delegate instanceof EnumDeclaration) {
  result.addError(delegate, "An enum cannot be an endpoint implementation.");
 }
 if (!isAssignable((TypeDeclaration) delegate, (TypeDeclaration) impl.getEndpointInterface().getDelegate())) {
  result.addError(delegate, "Class does not implement its endpoint interface!");
 }
 return result;
}

代码示例来源: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;
}

相关文章