public static <A extends Annotation> AnnotationBuilder<A> create( final Type<A> annotationType, final MethodList properties, final ReadOnlyList<Object> values) { checkProperties( VerifyArgument.notNull(annotationType, "annotationType"), properties, values ); return new AnnotationBuilder<>( annotationType, properties != null ? properties : MethodList.empty(), values != null ? values : ReadOnlyList.emptyList() ); }
public A getAnnotation() { if (_bakedAnnotation == null) { synchronized (this) { if (_bakedAnnotation == null) { bake(); } } } return _bakedAnnotation; }
private RetentionPolicy getAnnotationRetention(final AnnotationBuilder<? extends Annotation> a) { if (a.getAnnotationType().isAnnotationPresent(Retention.class)) { return a.getAnnotationType().getAnnotation(Retention.class).value(); } return RetentionPolicy.CLASS; }
private void writeAnnotation(final AnnotationBuilder<? extends Annotation> a) { _dataBuffer.putShort(_typeBuilder.getUtf8StringToken(a.getAnnotationType().getSignature())); _dataBuffer.putShort(a.getValues().size()); final MethodList attributes = a.getAttributes(); final ReadOnlyList<Object> values = a.getValues(); for (int i = 0, n = attributes.size(); i < n; i++) { final MethodInfo attribute = attributes.get(i); _dataBuffer.putShort(_typeBuilder.getUtf8StringToken(attribute.getName())); writeAttributeType(values.get(i)); } }
private Annotation[] bakeAnnotations() { final List<AnnotationBuilder<? extends Annotation>> annotationList = _annotations; if (annotationList.isEmpty()) { return EmptyArrayCache.fromElementType(Annotation.class); } final Annotation[] annotations = new Annotation[annotationList.size()]; for (int i = 0; i < annotations.length; i++) { annotations[i] = annotationList.get(i).getAnnotation(); } return annotations; }
private void writeAnnotation(final AnnotationBuilder<? extends Annotation> a) { _dataBuffer.putShort(_typeBuilder.getUtf8StringToken(a.getAnnotationType().getSignature())); _dataBuffer.putShort(a.getValues().size()); final MethodList attributes = a.getAttributes(); final ReadOnlyList<Object> values = a.getValues(); for (int i = 0, n = attributes.size(); i < n; i++) { final MethodInfo attribute = attributes.get(i); _dataBuffer.putShort(_typeBuilder.getUtf8StringToken(attribute.getName())); writeAttributeType(values.get(i)); } }
@Override public <A extends Annotation> A getAnnotation(final Class<A> annotationClass) { if (isCreated()) { return _generatedType.getAnnotation(annotationClass); } else { final AnnotationBuilder<A> annotation = (AnnotationBuilder<A>) _annotationMap.get(annotationClass); if (annotation != null) { return annotation.getAnnotation(); } return null; } }
public static <A extends Annotation> AnnotationBuilder<A> create( final Type<A> annotationType, final MethodList properties, final ReadOnlyList<Object> values) { checkProperties( VerifyArgument.notNull(annotationType, "annotationType"), properties, values ); return new AnnotationBuilder<>( annotationType, properties != null ? properties : MethodList.empty(), values != null ? values : ReadOnlyList.emptyList() ); }
private void writeAnnotation(final AnnotationBuilder<? extends Annotation> a) { _dataBuffer.putShort(_typeBuilder.getUtf8StringToken(a.getAnnotationType().getSignature())); _dataBuffer.putShort(a.getValues().size()); final MethodList attributes = a.getAttributes(); final ReadOnlyList<Object> values = a.getValues(); for (int i = 0, n = attributes.size(); i < n; i++) { final MethodInfo attribute = attributes.get(i); _dataBuffer.putShort(_typeBuilder.getUtf8StringToken(attribute.getName())); writeAttributeType(values.get(i)); } }
private RetentionPolicy getAnnotationRetention(final AnnotationBuilder<? extends Annotation> a) { if (a.getAnnotationType().isAnnotationPresent(Retention.class)) { return a.getAnnotationType().getAnnotation(Retention.class).value(); } return RetentionPolicy.CLASS; }
public A getAnnotation() { if (_bakedAnnotation == null) { synchronized (this) { if (_bakedAnnotation == null) { bake(); } } } return _bakedAnnotation; }
public static <A extends Annotation> AnnotationBuilder<A> create( final Type<A> annotationType, final MethodList properties, final ReadOnlyList<Object> values) { checkProperties( VerifyArgument.notNull(annotationType, "annotationType"), properties, values ); return new AnnotationBuilder<>( annotationType, properties != null ? properties : MethodList.empty(), values != null ? values : ReadOnlyList.emptyList() ); }
private RetentionPolicy getAnnotationRetention(final AnnotationBuilder<? extends Annotation> a) { if (a.getAnnotationType().isAnnotationPresent(Retention.class)) { return a.getAnnotationType().getAnnotation(Retention.class).value(); } return RetentionPolicy.CLASS; }
public A getAnnotation() { if (_bakedAnnotation == null) { synchronized (this) { if (_bakedAnnotation == null) { bake(); } } } return _bakedAnnotation; }
public static <A extends Annotation> AnnotationBuilder<A> create(final Type<A> annotationType) { checkProperties( VerifyArgument.notNull(annotationType, "annotationType"), MethodList.empty(), ReadOnlyList.emptyList() ); return new AnnotationBuilder<>(annotationType, MethodList.empty(), ReadOnlyList.emptyList()); }
public void addCustomAnnotation(final AnnotationBuilder<? extends Annotation> annotation) { VerifyArgument.notNull(annotation, "annotation"); final Class<? extends Annotation> annotationClass = annotation.getAnnotationType().getErasedClass(); if (_annotationMap != null) { if (_annotationMap.containsKey(annotationClass)) { throw new IllegalArgumentException( "@" + annotation.getAnnotationType().getShortName() + " is already defined." ); } } else { _annotationMap = new HashMap<>(); } final AnnotationBuilder[] newAnnotations = new AnnotationBuilder[this._annotations.size() + 1]; _annotations.toArray(newAnnotations); newAnnotations[this._annotations.size()] = annotation; _annotations = new ReadOnlyList<AnnotationBuilder<? extends Annotation>>(newAnnotations); _annotationMap.put(annotationClass, annotation); }
_hasBeenCreated = true; for (final AnnotationBuilder annotation : _annotations) { annotation.bake();
public static <A extends Annotation> AnnotationBuilder<A> create(final Type<A> annotationType) { checkProperties( VerifyArgument.notNull(annotationType, "annotationType"), MethodList.empty(), ReadOnlyList.emptyList() ); return new AnnotationBuilder<>(annotationType, MethodList.empty(), ReadOnlyList.emptyList()); }
final AnnotationBuilder valueAnnotation = (AnnotationBuilder)value; if (!propertyType.isAssignableFrom(valueAnnotation.getAnnotationType())) { throw Error.attributeValueIncompatible( propertyType, valueAnnotation.getAnnotationType() );
_hasBeenCreated = true; for (final AnnotationBuilder annotation : _annotations) { annotation.bake();