public interface BeanElementBuilder extends ConfigurableElement
EMPTY_ELEMENT_ARRAY
CLASS_NAME_SUFFIX, EMPTY_METADATA, VALUE_MEMBER
EMPTY
Modifier and Type | Method and Description |
---|---|
default <T extends Annotation> |
annotate(Class<T> annotationType)
Annotate this element with the given annotation type.
|
default <T extends Annotation> |
annotate(Class<T> annotationType,
Consumer<AnnotationValueBuilder<T>> consumer)
Annotate this element with the given annotation type.
|
default BeanElementBuilder |
annotate(String annotationType)
Annotate this element with the given annotation type.
|
default <T extends Annotation> |
annotate(String annotationType,
Consumer<AnnotationValueBuilder<T>> consumer)
Annotate this element with the given annotation type.
|
BeanElementBuilder |
createWith(MethodElement element)
Specifies the bean will created with the given method element.
|
ClassElement |
getBeanType() |
default ClassElement |
getDeclaringElement()
Returns the class that declares the bean.
|
Element |
getOriginatingElement() |
default Element |
getProducingElement() |
BeanElementBuilder |
inject()
Dependency inject this bean.
|
default BeanElementBuilder |
intercept(AnnotationValue<?>... annotationValue)
Intercept the bean.
|
default <E extends MemberElement> |
produceBeans(ElementQuery<E> methodsOrFields)
Produce additional beans from the given methods.
|
<E extends MemberElement> |
produceBeans(ElementQuery<E> methodsOrFields,
Consumer<BeanElementBuilder> childBeanBuilder)
Produce additional beans from the given methods.
|
default BeanElementBuilder |
qualifier(AnnotationValue<?> qualifier)
Adds a qualifier for the given annotation value to the element.
|
default BeanElementBuilder |
qualifier(String qualifier)
Adds a
Named qualifier to the element. |
default <T extends Annotation> |
removeAnnotation(Class<T> annotationType) |
default BeanElementBuilder |
removeAnnotation(String annotationType)
Removes an annotation of the given type from the element.
|
default <T extends Annotation> |
removeAnnotationIf(Predicate<AnnotationValue<T>> predicate)
Removes all annotations that pass the given predicate.
|
default <T extends Annotation> |
removeStereotype(Class<T> annotationType)
Removes a stereotype annotation of the given type from the element.
|
default BeanElementBuilder |
removeStereotype(String annotationType)
Removes a stereotype of the given name from the element.
|
default BeanElementBuilder |
scope(AnnotationValue<?> scope)
Adds a scope for the given annotation value to the bean.
|
default BeanElementBuilder |
scope(String scope)
Adds a scope for the given annotation value to the bean.
|
BeanElementBuilder |
typeArguments(ClassElement... types)
Fills the type arguments for the bean with the given types.
|
BeanElementBuilder |
typeArgumentsForType(ClassElement type,
ClassElement... types)
Fills the type arguments for the given interface or super class with the given types.
|
BeanElementBuilder |
typed(ClassElement... types)
Alters the exposed types for the bean limiting the exposed type to the given types.
|
BeanElementBuilder |
withConstructor(Consumer<BeanConstructorElement> constructorElement)
Allows configuring the bean constructor.
|
BeanElementBuilder |
withFields(ElementQuery<FieldElement> fields,
Consumer<BeanFieldElement> beanFields)
Allows configuring fields of the bean.
|
BeanElementBuilder |
withMethods(ElementQuery<MethodElement> methods,
Consumer<BeanMethodElement> beanMethods)
Allows configuring methods of the bean.
|
BeanElementBuilder |
withParameters(Consumer<BeanParameterElement[]> parameters)
Allows configuring the parameters for the current constructor.
|
annotate, getDescription, getDescription, getDocumentation, getModifiers, getName, getNativeType, getSimpleName, isAbstract, isFinal, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic
booleanValue, booleanValue, booleanValue, booleanValue, classValue, classValue, classValue, classValue, classValues, classValues, classValues, classValues, doubleValue, doubleValue, doubleValue, enumValue, enumValue, enumValue, enumValue, enumValues, enumValues, enumValues, enumValues, findAnnotation, findAnnotation, findDeclaredAnnotation, findDeclaredAnnotation, findRepeatableAnnotation, findRepeatableAnnotation, getAnnotation, getAnnotation, getAnnotationNameByStereotype, getAnnotationNameByStereotype, getAnnotationNames, getAnnotationNamesByStereotype, getAnnotationNamesByStereotype, getAnnotationType, getAnnotationType, getAnnotationTypeByStereotype, getAnnotationTypeByStereotype, getAnnotationTypesByStereotype, getAnnotationTypesByStereotype, getAnnotationTypesByStereotype, getAnnotationValuesByType, getDeclaredAnnotation, getDeclaredAnnotation, getDeclaredAnnotationNameByStereotype, getDeclaredAnnotationNames, getDeclaredAnnotationNamesByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationValuesByType, getDeclaredMetadata, getDeclaredStereotypeAnnotationNames, getDefaultValue, getDefaultValue, getDefaultValue, getDefaultValue, getDefaultValues, getStereotypeAnnotationNames, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValues, getValues, hasAnnotation, hasAnnotation, hasDeclaredAnnotation, hasDeclaredAnnotation, hasDeclaredStereotype, hasDeclaredStereotype, hasDeclaredStereotype, hasPropertyExpressions, hasSimpleAnnotation, hasSimpleDeclaredAnnotation, hasStereotype, hasStereotype, hasStereotype, hasStereotype, intValue, intValue, intValue, isAnnotationPresent, isDeclaredAnnotationPresent, isEmpty, isFalse, isFalse, isPresent, isPresent, isRepeatableAnnotation, isRepeatableAnnotation, isTrue, isTrue, longValue, longValue, stringValue, stringValue, stringValue, stringValue, stringValues, stringValues, stringValues, stringValues, synthesize, synthesize, synthesizeAll, synthesizeAnnotationsByType, synthesizeDeclared, synthesizeDeclared, synthesizeDeclared, synthesizeDeclaredAnnotationsByType
getAnnotationValuesByName, getAnnotationValuesByStereotype, getDeclaredAnnotationValuesByName, getValues, hasDeclaredStereotype, isAnnotationPresent, isDeclaredAnnotationPresent
isDeclaredNonNull, isDeclaredNullable, isNonNull, isNullable
getAnnotationMetadata
@NonNull default BeanElementBuilder intercept(AnnotationValue<?>... annotationValue)
annotationValue
- The annotation to intercept@NonNull ClassElement getBeanType()
@NonNull default Element getProducingElement()
@NonNull default ClassElement getDeclaringElement()
@NonNull BeanElementBuilder createWith(@NonNull MethodElement element)
ClassElement.getPrimaryConstructor()
.
Note that the method can be a one of the following:
element
- The element@NonNull BeanElementBuilder typed(ClassElement... types)
types
- 1 or more types to expose@NonNull BeanElementBuilder typeArguments(@NonNull ClassElement... types)
typeArguments
in interface ConfigurableElement
types
- The types@NonNull BeanElementBuilder typeArgumentsForType(@Nullable ClassElement type, @NonNull ClassElement... types)
type
- The type or interface. If null, results in a no-optypes
- The types@NonNull default BeanElementBuilder scope(@NonNull AnnotationValue<?> scope)
scope
- The scope@NonNull default BeanElementBuilder scope(@NonNull String scope)
scope
- The full qualified scope annotation name@NonNull BeanElementBuilder withConstructor(@NonNull Consumer<BeanConstructorElement> constructorElement)
constructorElement
- The constructor element@NonNull BeanElementBuilder withMethods(@NonNull ElementQuery<MethodElement> methods, @NonNull Consumer<BeanMethodElement> beanMethods)
methods
- The ElementQuery
to locate selected methods.beanMethods
- A consumer that receives each BeanMethodElement
@NonNull BeanElementBuilder withFields(@NonNull ElementQuery<FieldElement> fields, @NonNull Consumer<BeanFieldElement> beanFields)
fields
- The ElementQuery
to locate fields.beanFields
- The bean fields@NonNull BeanElementBuilder withParameters(Consumer<BeanParameterElement[]> parameters)
parameters
- The parameters@NonNull default BeanElementBuilder qualifier(@Nullable String qualifier)
ConfigurableElement
Named
qualifier to the element.qualifier
in interface ConfigurableElement
qualifier
- The qualifier. If null
an named annotation with no value is added assuming the default name.@NonNull default BeanElementBuilder qualifier(@NonNull AnnotationValue<?> qualifier)
ConfigurableElement
qualifier
in interface ConfigurableElement
qualifier
- The qualifier@NonNull default <T extends Annotation> BeanElementBuilder annotate(@NonNull String annotationType, @NonNull Consumer<AnnotationValueBuilder<T>> consumer)
Element
annotate
in interface Element
T
- The annotation generic typeannotationType
- The annotation typeconsumer
- A function that receives the AnnotationValueBuilder
default BeanElementBuilder removeAnnotation(@NonNull String annotationType)
Element
If the annotation features any stereotypes these will also be removed unless there are other annotations that reference the stereotype to be removed.
In the case of repeatable annotations this method will remove all repeated annotations, effectively clearing out all declared repeated annotations of the given type.
removeAnnotation
in interface Element
annotationType
- The annotation typedefault <T extends Annotation> BeanElementBuilder removeAnnotation(@NonNull Class<T> annotationType)
removeAnnotation
in interface Element
T
- The annotation generic typeannotationType
- The annotation typeElement.removeAnnotation(String)
default <T extends Annotation> BeanElementBuilder removeAnnotationIf(@NonNull Predicate<AnnotationValue<T>> predicate)
Element
removeAnnotationIf
in interface Element
T
- The annotation generic typepredicate
- The predicatedefault BeanElementBuilder removeStereotype(@NonNull String annotationType)
Element
removeStereotype
in interface Element
annotationType
- The annotation typedefault <T extends Annotation> BeanElementBuilder removeStereotype(@NonNull Class<T> annotationType)
Element
removeStereotype
in interface Element
T
- The annotation generic typeannotationType
- The annotation type@NonNull default BeanElementBuilder annotate(@NonNull String annotationType)
Element
@NonNull default <T extends Annotation> BeanElementBuilder annotate(@NonNull Class<T> annotationType, @NonNull Consumer<AnnotationValueBuilder<T>> consumer)
Element
annotate
in interface Element
T
- The annotation generic typeannotationType
- The annotation typeconsumer
- A function that receives the AnnotationValueBuilder
@NonNull default <T extends Annotation> BeanElementBuilder annotate(@NonNull Class<T> annotationType)
Element
BeanElementBuilder inject()
<E extends MemberElement> BeanElementBuilder produceBeans(ElementQuery<E> methodsOrFields, @Nullable Consumer<BeanElementBuilder> childBeanBuilder)
E
- A type variable tomethodsOrFields
- The ElementQuery
representing the methods or fieldschildBeanBuilder
- Configure the child bean builderdefault <E extends MemberElement> BeanElementBuilder produceBeans(ElementQuery<E> methodsOrFields)
E
- A type variable tomethodsOrFields
- The ElementQuery
representing the methods or fields