Java 8 AnnotationMirror - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 AnnotationMirror class.

This code example shows how to use the following methods:getAnnotationType
				break; 
			case SHORT:
				type = ShortBuffer.class;
				break; 
			case LONG:
				if ( annotation.getAnnotationType().asElement().getAnnotation(PointerType.class) != null ) {
					type = PointerBuffer.class;
				} else { 
					type = LongBuffer.class;
				} 
				break; 
			case BYTE: /* fall through */
 
			case BOOLEAN:
				type = ByteBuffer.class;
				break; 
			default: 
				throw new RuntimeException(kind + " is not allowed");
		} 
		return type;
5
CodeRank
This code example shows how to use the following methods:getAnnotationType
			return null; 
	} 
 
	@Override 
	public String getAutoTypeFromAnnotation(AnnotationMirror annotation) {
		Class annotation_class = NativeTypeTranslator.getClassFromType(annotation.getAnnotationType());
		if ( annotation_class.equals(GLint.class) )
			return "GLES20.GL_INT"; 
		else if ( annotation_class.equals(GLbyte.class) )
			return "GLES20.GL_BYTE"; 
		else if ( annotation_class.equals(GLshort.class) )
			return "GLES20.GL_SHORT"; 
		if ( annotation_class.equals(GLuint.class) )
			return "GLES20.GL_UNSIGNED_INT"; 
		else if ( annotation_class.equals(GLubyte.class) )
			return "GLES20.GL_UNSIGNED_BYTE"; 
		else if ( annotation_class.equals(GLushort.class) )
			return "GLES20.GL_UNSIGNED_SHORT"; 
		else if ( annotation_class.equals(GLfloat.class) )
			return "GLES20.GL_FLOAT"; 
5
CodeRank
This code example shows how to use the following methods:getAnnotationType
		} 
	} 
 
	@Override 
	public String getAutoTypeFromAnnotation(AnnotationMirror annotation) {
		Class annotation_class = NativeTypeTranslator.getClassFromType(annotation.getAnnotationType());
		if ( annotation_class.equals(GLint.class) ) {
			return "GL11.GL_INT"; 
		} else if ( annotation_class.equals(GLbyte.class) ) {
			return "GL11.GL_BYTE"; 
		} else if ( annotation_class.equals(GLshort.class) ) {
			return "GL11.GL_SHORT"; 
		} 
		if ( annotation_class.equals(GLuint.class) ) {
			return "GL11.GL_UNSIGNED_INT"; 
		} else if ( annotation_class.equals(GLubyte.class) ) {
			return "GL11.GL_UNSIGNED_BYTE"; 
		} else if ( annotation_class.equals(GLushort.class) ) {
			return "GL11.GL_UNSIGNED_SHORT"; 
		} else if ( annotation_class.equals(GLfloat.class) ) {
5
CodeRank
This code example shows how to use the following methods:getAnnotationType
  /** . */ 
  final Name type; 
 
  public AnnotationKey(Element element, AnnotationMirror mirror) {
    this.element = ElementHandle.create(element);
    this.type = Name.parse(((TypeElement)mirror.getAnnotationType().asElement()).getQualifiedName().toString());
  } 
 
  public AnnotationKey(Element element, Name type) {
    this.element = ElementHandle.create(element);
    this.type = type;
  } 
 
  public AnnotationKey(ElementHandle<?> element, Name type) {
    this.element = element;
    this.type = type;
  } 
 
  public ElementHandle<?> getElement() { 
    return element;
4
CodeRank
This code example shows how to use the following methods:getAnnotationType
This code example shows how to use the following methods:getAnnotationType
	 * @return {@code true} if the provided annotation type is of the same type as the provided class, {@code false} otherwise. 
	 */ 
	public static boolean isAnnotationMirrorOfType(AnnotationMirror annotationMirror, String fqcn) {
		assert annotationMirror != null;
		assert fqcn != null;
		String annotationClassName = annotationMirror.getAnnotationType().toString();
 
		return annotationClassName.equals( fqcn );
	} 
 
	/** 
	 * Checks whether the {@code Element} hosts the annotation with the given fully qualified class name. 
	 * 
	 * @param element the element to check for the hosted annotation 
	 * @param fqcn the fully qualified class name of the annotation to check for 
	 * 
	 * @return the annotation mirror for the specified annotation class from the {@code Element} or {@code null} in case 
	 *         the {@code TypeElement} does not host the specified annotation. 
	 */ 
	public static AnnotationMirror getAnnotationMirror(Element element, String fqcn) {
4
CodeRank
This code example shows how to use the following methods:getAnnotationType
        return out;
    } 
 
    /** Return true if the given annotation mirror equals the given annotation class */ 
    private static boolean equals(AnnotationMirror annotationMirror, Class<? extends Annotation> annotationClass) {
        return annotationMirror.getAnnotationType().toString().equals(annotationClass.getName());
    } 
 
    public static AnnotationMirror getAnnotation(Element element, Class<? extends Annotation> annotationClass) {
        for (AnnotationMirror annotationMirror : element.getAnnotationMirrors()) {
            if (annotationMirror.getAnnotationType().toString().equals(annotationClass.getName())) {
                return annotationMirror;
            } 
        } 
        return null; 
    } 
 
    @SuppressWarnings("unchecked") 
    public static <T> T getAnnotationValue(AnnotationMirror annotationMirror, String key) {
        for (Map.Entry<? extends ExecutableElement, ? extends AnnotationValue> entry : annotationMirror.getElementValues().entrySet()) {
3
CodeRank
This code example shows how to use the following methods:getAnnotationType
This code example shows how to use the following methods:getAnnotationType
This code example shows how to use the following methods:getAnnotationType
        return qualiferAnnotations;
    } 
 
    private void addOnlyWhenQualifier( Set<TypeMirror> annotationSet, AnnotationMirror candidate ) {
        // only add the candidate annotation when the candidate itself has the annotation 'Qualifier' 
        if ( QualifierPrism.getInstanceOn( candidate.getAnnotationType().asElement() ) != null ) {
            annotationSet.add( candidate.getAnnotationType() );
        } 
    } 
 
} 
 
3
CodeRank
See Code Examples for Java 8 AnnotationMirror Methods: