/** * Adds all annotations from an {@link AnnotationStore}. * * @param annotations annotations to be added * @return this */ public AnnotationBuilder addAll(AnnotationStore annotations) { for (Annotation annotation : annotations.getAnnotations()) { add(annotation); } return this; }
/** * Remove an annotation from the type * * @param annotationType the annotation type to remove * @throws IllegalArgumentException if the annotationType */ public AnnotatedTypeBuilder<X> removeFromClass(Class<? extends Annotation> annotationType) { typeAnnotations.remove(annotationType); return this; }
/** * Reads the annotations from an existing java type. Annotations already * present will be overwritten * * @param type the type to read from * @throws IllegalArgumentException if type is null */ public AnnotatedTypeBuilder<X> readFromType(Class<X> type) { return readFromType(type, true); }
private <X> InjectableMethod<X> createInjectableMethod(AnnotatedMethod<X> handlerMethod, Bean<?> bean, BeanManager bm) { return new InjectableMethod<X>(handlerMethod, bean, bm); }
/** * {@inheritDoc} */ @Override public <T extends Annotation> T getAnnotation(Class<T> annotationType) { return annotations.getAnnotation(annotationType); }
/** * {@inheritDoc} */ @Override public boolean isAnnotationPresent(Class<? extends Annotation> annotationType) { return annotations.isAnnotationPresent(annotationType); }
@Override public T create(CreationalContext<T> creationalContext) { return lifecycle.create(this, creationalContext); }
@Override public void destroy(T instance, CreationalContext<T> creationalContext) { this.lifecycle.destroy(this, instance, creationalContext); } }
/** * Add an annotation to the type declaration. * * @param annotation the annotation instance to add * @throws IllegalArgumentException if the annotation is null */ public AnnotatedTypeBuilder<X> addToClass(Annotation annotation) { typeAnnotations.add(annotation); return this; }
/** * {@inheritDoc} */ @Override public Set<Annotation> getAnnotations() { return annotations.getAnnotations(); }
protected AnnotatedCallableImpl(AnnotatedType<X> declaringType, Y member, Class<?> memberType, Class<?>[] parameterTypes, Type[] genericTypes, AnnotationStore annotations, Map<Integer, AnnotationStore> parameterAnnotations, Type genericType, Map<Integer, Type> parameterTypeOverrides) { super(declaringType, member, memberType, annotations, genericType, null); parameters = getAnnotatedParameters(this, parameterTypes, genericTypes, parameterAnnotations, parameterTypeOverrides); }
/** * Creates an {@link AnnotationStore} using the annotations from this instance. * * @return new AnnotationStore */ public AnnotationStore create() { return new AnnotationStore(annotationMap, annotationSet); }
/** * Reads the annotations from an existing java type. Annotations already * present will be overwritten * * @param type the type to read from * @throws IllegalArgumentException if type is null */ public AnnotatedTypeBuilder<X> readFromType(Class<X> type) { return readFromType(type, true); }
/** * Adds all annotations from an {@link AnnotationStore}. * * @param annotations annotations to be added * @return this */ public AnnotationBuilder addAll(AnnotationStore annotations) { for (Annotation annotation : annotations.getAnnotations()) { add(annotation); } return this; }
/** * Remove an annotation from the type * * @param annotationType the annotation type to remove * @throws IllegalArgumentException if the annotationType */ public AnnotatedTypeBuilder<X> removeFromClass(Class<? extends Annotation> annotationType) { typeAnnotations.remove(annotationType); return this; }
/** * {@inheritDoc} */ @Override public <T extends Annotation> T getAnnotation(Class<T> annotationType) { return annotations.getAnnotation(annotationType); }
/** * {@inheritDoc} */ @Override public boolean isAnnotationPresent(Class<? extends Annotation> annotationType) { return annotations.isAnnotationPresent(annotationType); }
@Override public T create(CreationalContext<T> creationalContext) { return lifecycle.create(this, creationalContext); }
@Override public void destroy(T instance, CreationalContext<T> creationalContext) { this.lifecycle.destroy(this, instance, creationalContext); } }
/** * Reads in from an existing AnnotatedType. Any elements not present are * added. The javaClass will be read in. If the annotation already exists on * that element in the builder the read annotation will be used. * * @param type the type to read from * @throws IllegalArgumentException if type is null */ public AnnotatedTypeBuilder<X> readFromType(AnnotatedType<X> type) { return readFromType(type, true); }