public class SolderAnnotatedTypeBuilder<X> extends Object
AnnotatedType for use in CDI life cycle events.
Using the builder is typically done by reading the annotations from a Class or an
AnnotatedType. Once the starting class or type has been added all of annotations
can be modified: constructor, parameter, class, method and fields.
The AnnotatedTypeBuilder is not thread safe and shall not be used concurrently!
Based on DS 0.3-incubating:
- added SolderMessages
- added redefined support that is only used by this class (these are dependent classes):
-- AnnotatedTypeImpl
-- AnnotatedCallableImpl
-- AnnotatedMemberImpl
-- AnnotatedConstructorImpl
-- AnnotatedImpl
-- AnnotatedParameterImpl
-- AnnotatedMethodImpl
-- AnnotatedFieldImpl| Constructor and Description |
|---|
SolderAnnotatedTypeBuilder()
Create a new builder.
|
| Modifier and Type | Method and Description |
|---|---|
SolderAnnotatedTypeBuilder<X> |
addToClass(Annotation annotation)
Add an annotation to the type declaration.
|
SolderAnnotatedTypeBuilder<X> |
addToConstructor(javax.enterprise.inject.spi.AnnotatedConstructor<X> constructor,
Annotation annotation)
Add an annotation to the specified constructor.
|
SolderAnnotatedTypeBuilder<X> |
addToConstructor(Constructor<X> constructor,
Annotation annotation)
Add an annotation to the specified constructor.
|
SolderAnnotatedTypeBuilder<X> |
addToConstructorParameter(Constructor<X> constructor,
int position,
Annotation annotation)
Add an annotation to the specified constructor parameter.
|
SolderAnnotatedTypeBuilder<X> |
addToField(javax.enterprise.inject.spi.AnnotatedField<? super X> field,
Annotation annotation)
Add an annotation to the specified field.
|
SolderAnnotatedTypeBuilder<X> |
addToField(Field field,
Annotation annotation)
Add an annotation to the specified field.
|
SolderAnnotatedTypeBuilder<X> |
addToMethod(javax.enterprise.inject.spi.AnnotatedMethod<? super X> method,
Annotation annotation)
Add an annotation to the specified method.
|
SolderAnnotatedTypeBuilder<X> |
addToMethod(Method method,
Annotation annotation)
Add an annotation to the specified method.
|
SolderAnnotatedTypeBuilder<X> |
addToMethodParameter(Method method,
int position,
Annotation annotation)
Add an annotation to the specified method parameter.
|
SolderAnnotatedTypeBuilder<X> |
addToParameter(javax.enterprise.inject.spi.AnnotatedParameter<? super X> parameter,
Annotation annotation)
Add an annotation to the specified parameter.
|
javax.enterprise.inject.spi.AnnotatedType<X> |
create()
Create an
AnnotatedType. |
Class<X> |
getJavaClass()
getter for the class
|
protected void |
mergeAnnotationsOnElement(javax.enterprise.inject.spi.Annotated annotated,
boolean overwriteExisting,
AnnotationBuilder typeAnnotations) |
SolderAnnotatedTypeBuilder<X> |
overrideConstructorParameterType(Constructor<X> constructor,
int position,
Type type)
Override the declared type of a constructor parameter
|
void |
overrideFieldType(javax.enterprise.inject.spi.AnnotatedField<? super X> field,
Type type)
Override the declared type of a field
|
void |
overrideFieldType(Field field,
Type type)
Override the declared type of a field
|
SolderAnnotatedTypeBuilder<X> |
overrideMethodParameterType(Method method,
int position,
Type type)
Override the declared type of a method parameter
|
SolderAnnotatedTypeBuilder<X> |
overrideParameterType(javax.enterprise.inject.spi.AnnotatedParameter<? super X> parameter,
Type type)
Override the declared type of a parameter.
|
SolderAnnotatedTypeBuilder<X> |
readFromType(javax.enterprise.inject.spi.AnnotatedType<X> type)
Reads in from an existing AnnotatedType.
|
SolderAnnotatedTypeBuilder<X> |
readFromType(javax.enterprise.inject.spi.AnnotatedType<X> type,
boolean overwrite)
Reads in from an existing AnnotatedType.
|
SolderAnnotatedTypeBuilder<X> |
readFromType(Class<X> type)
Reads the annotations from an existing java type.
|
SolderAnnotatedTypeBuilder<X> |
readFromType(Class<X> type,
boolean overwrite)
Reads the annotations from an existing java type.
|
<A extends Annotation> |
redefine(Class<A> annotationType,
AnnotationRedefiner<A> redefinition)
Redefine any annotations of the specified type.
|
protected <A extends Annotation> |
redefineAnnotationBuilder(Class<A> annotationType,
AnnotationRedefiner<A> redefinition,
AnnotatedElement annotated,
Type baseType,
AnnotationBuilder builder,
String elementName) |
SolderAnnotatedTypeBuilder<X> |
removeFromAll(Class<? extends Annotation> annotationType)
Remove annotations from the type, and all of it's members.
|
SolderAnnotatedTypeBuilder<X> |
removeFromClass(Class<? extends Annotation> annotationType)
Remove an annotation from the type
|
SolderAnnotatedTypeBuilder<X> |
removeFromConstructor(javax.enterprise.inject.spi.AnnotatedConstructor<X> constructor,
Class<? extends Annotation> annotationType)
Remove an annotation from the specified constructor.
|
SolderAnnotatedTypeBuilder<X> |
removeFromConstructor(Constructor<X> constructor,
Class<? extends Annotation> annotationType)
Remove an annotation from the specified constructor.
|
SolderAnnotatedTypeBuilder<X> |
removeFromConstructorParameter(Constructor<X> constructor,
int position,
Class<? extends Annotation> annotationType)
Remove an annotation from the specified constructor parameter.
|
SolderAnnotatedTypeBuilder<X> |
removeFromField(javax.enterprise.inject.spi.AnnotatedField<? super X> field,
Class<? extends Annotation> annotationType)
Remove an annotation from the specified field.
|
SolderAnnotatedTypeBuilder<X> |
removeFromField(Field field,
Class<? extends Annotation> annotationType)
Remove an annotation from the specified field.
|
SolderAnnotatedTypeBuilder<X> |
removeFromMethod(javax.enterprise.inject.spi.AnnotatedMethod<? super X> method,
Class<? extends Annotation> annotationType)
Remove an annotation from the specified method.
|
SolderAnnotatedTypeBuilder<X> |
removeFromMethod(Method method,
Class<? extends Annotation> annotationType)
Remove an annotation from the specified method.
|
SolderAnnotatedTypeBuilder<X> |
removeFromMethodParameter(Method method,
int position,
Class<? extends Annotation> annotationType)
Remove an annotation from the specified method parameter.
|
SolderAnnotatedTypeBuilder<X> |
removeFromParameter(javax.enterprise.inject.spi.AnnotatedParameter<? super X> parameter,
Class<? extends Annotation> annotationType)
Remove an annotation from the specified parameter.
|
SolderAnnotatedTypeBuilder<X> |
setJavaClass(Class<X> javaClass)
setter for the class
|
public SolderAnnotatedTypeBuilder()
public SolderAnnotatedTypeBuilder<X> addToClass(Annotation annotation)
annotation - the annotation instance to addIllegalArgumentException - if the annotation is nullpublic SolderAnnotatedTypeBuilder<X> removeFromClass(Class<? extends Annotation> annotationType)
annotationType - the annotation type to removeIllegalArgumentException - if the annotationTypepublic SolderAnnotatedTypeBuilder<X> addToField(Field field, Annotation annotation)
field - the field to add the annotation toannotation - the annotation to addIllegalArgumentException - if the annotation is nullpublic SolderAnnotatedTypeBuilder<X> addToField(javax.enterprise.inject.spi.AnnotatedField<? super X> field, Annotation annotation)
field - the field to add the annotation toannotation - the annotation to addIllegalArgumentException - if the annotation is nullpublic SolderAnnotatedTypeBuilder<X> removeFromField(Field field, Class<? extends Annotation> annotationType)
field - the field to remove the annotation fromannotationType - the annotation type to removeIllegalArgumentException - if the annotationType is null or if the
field is not currently declared on the typepublic SolderAnnotatedTypeBuilder<X> removeFromField(javax.enterprise.inject.spi.AnnotatedField<? super X> field, Class<? extends Annotation> annotationType)
field - the field to remove the annotation fromannotationType - the annotation type to removeIllegalArgumentException - if the annotationType is null or if the
field is not currently declared on the typepublic SolderAnnotatedTypeBuilder<X> addToMethod(Method method, Annotation annotation)
method - the method to add the annotation toannotation - the annotation to addIllegalArgumentException - if the annotation is nullpublic SolderAnnotatedTypeBuilder<X> addToMethod(javax.enterprise.inject.spi.AnnotatedMethod<? super X> method, Annotation annotation)
method - the method to add the annotation toannotation - the annotation to addIllegalArgumentException - if the annotation is nullpublic SolderAnnotatedTypeBuilder<X> removeFromMethod(Method method, Class<? extends Annotation> annotationType)
method - the method to remove the annotation fromannotationType - the annotation type to removeIllegalArgumentException - if the annotationType is null or if the
method is not currently declared on the typepublic SolderAnnotatedTypeBuilder<X> removeFromMethod(javax.enterprise.inject.spi.AnnotatedMethod<? super X> method, Class<? extends Annotation> annotationType)
method - the method to remove the annotation fromannotationType - the annotation type to removeIllegalArgumentException - if the annotationType is null or if the
method is not currently declared on the typepublic SolderAnnotatedTypeBuilder<X> addToMethodParameter(Method method, int position, Annotation annotation)
method - the method to add the annotation toposition - the position of the parameter to addannotation - the annotation to addIllegalArgumentException - if the annotation is nullpublic SolderAnnotatedTypeBuilder<X> removeFromMethodParameter(Method method, int position, Class<? extends Annotation> annotationType)
method - the method to remove the annotation fromposition - the position of the parameter to removeannotationType - the annotation type to removeIllegalArgumentException - if the annotationType is null, if the
method is not currently declared on the type or if the
parameter is not declared on the methodpublic SolderAnnotatedTypeBuilder<X> addToConstructor(Constructor<X> constructor, Annotation annotation)
constructor - the constructor to add the annotation toannotation - the annotation to addIllegalArgumentException - if the annotation is nullpublic SolderAnnotatedTypeBuilder<X> addToConstructor(javax.enterprise.inject.spi.AnnotatedConstructor<X> constructor, Annotation annotation)
constructor - the constructor to add the annotation toannotation - the annotation to addIllegalArgumentException - if the annotation is nullpublic SolderAnnotatedTypeBuilder<X> removeFromConstructor(Constructor<X> constructor, Class<? extends Annotation> annotationType)
constructor - the constructor to add the annotation toannotationType - the annotation to addIllegalArgumentException - if the annotationType is null or if the
constructor is not currently declared on the typepublic SolderAnnotatedTypeBuilder<X> removeFromConstructor(javax.enterprise.inject.spi.AnnotatedConstructor<X> constructor, Class<? extends Annotation> annotationType)
constructor - the constructor to add the annotation toannotationType - the annotation to addIllegalArgumentException - if the annotationType is null, if the
annotation does not exist on the type or if the constructor is
not currently declared on the typepublic SolderAnnotatedTypeBuilder<X> addToConstructorParameter(Constructor<X> constructor, int position, Annotation annotation)
constructor - the constructor to add the annotation toposition - the position of the parameter to addannotation - the annotation to addIllegalArgumentException - if the annotation is nullpublic SolderAnnotatedTypeBuilder<X> removeFromConstructorParameter(Constructor<X> constructor, int position, Class<? extends Annotation> annotationType)
constructor - the constructor to remove the annotation fromposition - the position of the parameter to removeannotationType - the annotation type to removeIllegalArgumentException - if the annotationType is null, if the
constructor is not currently declared on the type or if the
parameter is not declared on the constructorpublic SolderAnnotatedTypeBuilder<X> removeFromParameter(javax.enterprise.inject.spi.AnnotatedParameter<? super X> parameter, Class<? extends Annotation> annotationType)
parameter - the parameter to remove the annotation fromannotationType - the annotation type to removeIllegalArgumentException - if the annotationType is null, if the
callable which declares the parameter is not currently declared
on the type or if the parameter is not declared on either a
constructor or a methodpublic SolderAnnotatedTypeBuilder<X> addToParameter(javax.enterprise.inject.spi.AnnotatedParameter<? super X> parameter, Annotation annotation)
parameter - the parameter to add the annotation toannotation - the annotation to addIllegalArgumentException - if the annotation is null or if the
parameter is not declared on either a constructor or a methodpublic SolderAnnotatedTypeBuilder<X> removeFromAll(Class<? extends Annotation> annotationType)
annotationType - the type of annotation to removeIllegalArgumentException - if the annotationType is nullpublic SolderAnnotatedTypeBuilder<X> readFromType(javax.enterprise.inject.spi.AnnotatedType<X> type)
type - the type to read fromIllegalArgumentException - if type is nullpublic SolderAnnotatedTypeBuilder<X> readFromType(javax.enterprise.inject.spi.AnnotatedType<X> type, boolean overwrite)
type - the type to read fromoverwrite - if true, the read annotation will replace any existing
annotationIllegalArgumentException - if type is nullpublic SolderAnnotatedTypeBuilder<X> readFromType(Class<X> type)
type - the type to read fromIllegalArgumentException - if type is nullpublic SolderAnnotatedTypeBuilder<X> readFromType(Class<X> type, boolean overwrite)
type - the type to read fromoverwrite - if true, the read annotation will replace any existing
annotationprotected void mergeAnnotationsOnElement(javax.enterprise.inject.spi.Annotated annotated,
boolean overwriteExisting,
AnnotationBuilder typeAnnotations)
public javax.enterprise.inject.spi.AnnotatedType<X> create()
AnnotatedType. Any public members present on the
underlying class and not overridden by the builder will be automatically
added.public void overrideFieldType(Field field, Type type)
field - the field to override the type ontype - the new type of the fieldIllegalArgumentException - if field or type is nullpublic void overrideFieldType(javax.enterprise.inject.spi.AnnotatedField<? super X> field, Type type)
field - the field to override the type ontype - the new type of the fieldIllegalArgumentException - if field or type is nullpublic SolderAnnotatedTypeBuilder<X> overrideMethodParameterType(Method method, int position, Type type)
method - the method to override the parameter type onposition - the position of the parameter to override the type ontype - the new type of the parameterIllegalArgumentException - if parameter or type is nullpublic SolderAnnotatedTypeBuilder<X> overrideConstructorParameterType(Constructor<X> constructor, int position, Type type)
constructor - the constructor to override the parameter type onposition - the position of the parameter to override the type ontype - the new type of the parameterIllegalArgumentException - if parameter or type is nullpublic SolderAnnotatedTypeBuilder<X> overrideParameterType(javax.enterprise.inject.spi.AnnotatedParameter<? super X> parameter, Type type)
parameter - the parameter to override the type ontype - the new type of the parameterIllegalArgumentException - if parameter or type is nullpublic SolderAnnotatedTypeBuilder<X> setJavaClass(Class<X> javaClass)
public <A extends Annotation> SolderAnnotatedTypeBuilder<X> redefine(Class<A> annotationType, AnnotationRedefiner<A> redefinition)
annotationType - the type of the annotation for which to call the
redefinitionredefinition - the redefiniton callbackIllegalArgumentException - if the annotationType or redefinition is
nullprotected <A extends Annotation> void redefineAnnotationBuilder(Class<A> annotationType, AnnotationRedefiner<A> redefinition, AnnotatedElement annotated, Type baseType, AnnotationBuilder builder, String elementName)
Copyright © 2013. All Rights Reserved.