public interface BeanDefinitionVisitor extends OriginatingElements, Toggleable
BeanDefinitionVisitor
implementations such as BeanDefinitionWriter
.Modifier and Type | Field and Description |
---|---|
static String |
PROXY_SUFFIX
The suffix use for generated AOP intercepted types.
|
Modifier and Type | Method and Description |
---|---|
void |
accept(ClassWriterOutputVisitor visitor)
Write the class to output via a visitor that manages output destination.
|
AnnotationMetadata |
getAnnotationMetadata() |
String |
getBeanDefinitionName() |
String |
getBeanDefinitionReferenceClassName() |
String |
getBeanSimpleName() |
String |
getBeanTypeName() |
Optional<org.objectweb.asm.Type> |
getInterceptedType() |
Element |
getOriginatingElement() |
String |
getPackageName() |
org.objectweb.asm.Type |
getProvidedType()
The provided type of the bean.
|
default ClassElement[] |
getTypeArguments() |
boolean |
isInterface() |
boolean |
isSingleton() |
boolean |
isValidated() |
default boolean |
requiresMethodProcessing()
By default, when the
BeanContext is started, the
BeanDefinition.getExecutableMethods() are not processed by registered
ExecutableMethodProcessor instances unless this method returns true. |
void |
setInterceptedType(String typeName)
Sets the name of the intercepted type.
|
void |
setRequiresMethodProcessing(boolean shouldPreProcess)
Sets whether the
BeanType.requiresMethodProcessing() returns true. |
void |
setValidated(boolean validated)
Make the bean definition as validated by javax.validation.
|
void |
visitAnnotationMemberPropertyInjectionPoint(TypedElement annotationMemberBeanType,
String annotationMemberProperty,
String requiredValue,
String notEqualsValue)
Visits an annotation injection point.
|
void |
visitBeanDefinitionConstructor(MethodElement constructor,
boolean requiresReflection,
VisitorContext visitorContext)
Visits the constructor used to create the bean definition.
|
void |
visitBeanDefinitionEnd()
Finalize the bean definition to the given output stream.
|
void |
visitBeanDefinitionInterface(Class<? extends BeanDefinition> interfaceType)
Visit a marker interface on the generated bean definition.
|
void |
visitConfigBuilderDurationMethod(String prefix,
ClassElement returnType,
String methodName,
String path)
Visit a configuration builder method that accepts a long and a TimeUnit.
|
void |
visitConfigBuilderEnd()
Finalize a configuration builder field.
|
void |
visitConfigBuilderField(ClassElement type,
String field,
AnnotationMetadata annotationMetadata,
ConfigurationMetadataBuilder<?> metadataBuilder,
boolean isInterface)
Begin defining a configuration builder.
|
void |
visitConfigBuilderMethod(ClassElement type,
String methodName,
AnnotationMetadata annotationMetadata,
ConfigurationMetadataBuilder<?> metadataBuilder,
boolean isInterface)
Begin defining a configuration builder.
|
void |
visitConfigBuilderMethod(String prefix,
ClassElement returnType,
String methodName,
ClassElement paramType,
Map<String,ClassElement> generics,
String path)
Visit a configuration builder method.
|
void |
visitDefaultConstructor(AnnotationMetadata annotationMetadata,
VisitorContext visitorContext)
Visits the constructor used to create the bean definition in the case where no constructor is present.
|
int |
visitExecutableMethod(TypedElement declaringBean,
MethodElement methodElement,
VisitorContext visitorContext)
Visit a method that is to be made executable allow invocation of said method without reflection.
|
void |
visitFieldInjectionPoint(TypedElement declaringType,
FieldElement fieldElement,
boolean requiresReflection)
Visits a field injection point.
|
void |
visitFieldValue(TypedElement declaringType,
FieldElement fieldElement,
boolean requiresReflection,
boolean isOptional)
Visits a field injection point.
|
void |
visitMethodInjectionPoint(TypedElement beanType,
MethodElement methodElement,
boolean requiresReflection,
VisitorContext visitorContext)
Visits a method injection point.
|
void |
visitPostConstructMethod(TypedElement declaringType,
MethodElement methodElement,
boolean requiresReflection,
VisitorContext visitorContext)
Visits a method injection point.
|
void |
visitPreDestroyMethod(TypedElement beanType,
MethodElement methodElement,
boolean requiresReflection,
VisitorContext visitorContext)
Visits a method injection point.
|
void |
visitSetterValue(TypedElement declaringType,
MethodElement methodElement,
boolean requiresReflection,
boolean isOptional)
Visits an injection point for a setter.
|
void |
visitSuperBeanDefinition(String name)
Alter the super class of this bean definition.
|
void |
visitSuperBeanDefinitionFactory(String beanName)
Alter the super class of this bean definition to use another factory bean.
|
void |
visitTypeArguments(Map<String,Map<String,ClassElement>> typeArguments)
Visits the type arguments for the bean.
|
void |
writeTo(File compilationDir)
Write the state of the writer to the given compilation directory.
|
addOriginatingElement, getOriginatingElements, of
isEnabled
static final String PROXY_SUFFIX
@Nullable Element getOriginatingElement()
void visitBeanDefinitionConstructor(MethodElement constructor, boolean requiresReflection, VisitorContext visitorContext)
constructor
- The method element that represents the constructorrequiresReflection
- Whether invoking the constructor requires reflectionvisitorContext
- The visitor contextvoid visitDefaultConstructor(AnnotationMetadata annotationMetadata, VisitorContext visitorContext)
annotationMetadata
- The annotation metadata for the constructorvisitorContext
- The visitor context@NonNull String getBeanDefinitionReferenceClassName()
boolean isInterface()
boolean isSingleton()
void visitBeanDefinitionInterface(Class<? extends BeanDefinition> interfaceType)
interfaceType
- The interface typevoid visitSuperBeanDefinition(String name)
AbstractBeanDefinition
.name
- The super typevoid visitSuperBeanDefinitionFactory(String beanName)
beanName
- The bean nameString getBeanTypeName()
org.objectweb.asm.Type getProvidedType()
getBeanTypeName()
, except in the case of
factory beans which produce a different type.void setValidated(boolean validated)
validated
- Whether the bean definition is validatedvoid setInterceptedType(String typeName)
typeName
- The type nameOptional<org.objectweb.asm.Type> getInterceptedType()
boolean isValidated()
String getBeanDefinitionName()
void visitBeanDefinitionEnd()
void writeTo(File compilationDir) throws IOException
compilationDir
- The compilation directoryIOException
- If an I/O error occursvoid accept(ClassWriterOutputVisitor visitor) throws IOException
visitor
- the writer output visitorIOException
- If an error occursvoid visitSetterValue(TypedElement declaringType, MethodElement methodElement, boolean requiresReflection, boolean isOptional)
declaringType
- The declaring typemethodElement
- The method elementrequiresReflection
- Whether the setter requires reflectionisOptional
- Whether the setter is optionalvoid visitPostConstructMethod(TypedElement declaringType, MethodElement methodElement, boolean requiresReflection, VisitorContext visitorContext)
declaringType
- The declaring type of the method. Either a Class or a string representing
the name of the typemethodElement
- The method elementrequiresReflection
- Whether the method requires reflectionvisitorContext
- The visitor contextvoid visitPreDestroyMethod(TypedElement beanType, MethodElement methodElement, boolean requiresReflection, VisitorContext visitorContext)
beanType
- The bean type of the methodmethodElement
- The method elementrequiresReflection
- Whether the method requires reflectionvisitorContext
- The visitor contextvoid visitMethodInjectionPoint(TypedElement beanType, MethodElement methodElement, boolean requiresReflection, VisitorContext visitorContext)
beanType
- The bean type of the methodmethodElement
- The method elementrequiresReflection
- Whether the method requires reflectionvisitorContext
- The visitor contextint visitExecutableMethod(TypedElement declaringBean, MethodElement methodElement, VisitorContext visitorContext)
declaringBean
- The declaring bean of the method. Note this may differ from MemberElement.getDeclaringType()
in the case of the method coming from a super class or interface.methodElement
- The method elementvisitorContext
- The visitor contextvoid visitFieldInjectionPoint(TypedElement declaringType, FieldElement fieldElement, boolean requiresReflection)
declaringType
- The declaring type. Either a Class or a string representing the name of the typefieldElement
- The field elementrequiresReflection
- Whether accessing the field requires reflectionvoid visitAnnotationMemberPropertyInjectionPoint(TypedElement annotationMemberBeanType, String annotationMemberProperty, @Nullable String requiredValue, @Nullable String notEqualsValue)
annotationMemberBeanType
- The type of the injected beanannotationMemberProperty
- Required property of the injected beanrequiredValue
- Required value of the bean property for the bean to be loadednotEqualsValue
- The bean property value which should not be equal to present value for the bean to
be loadedvoid visitFieldValue(TypedElement declaringType, FieldElement fieldElement, boolean requiresReflection, boolean isOptional)
declaringType
- The declaring type. Either a Class or a string representing the name of the typefieldElement
- The field elementrequiresReflection
- Whether accessing the field requires reflectionisOptional
- Is the value optionalString getPackageName()
String getBeanSimpleName()
AnnotationMetadata getAnnotationMetadata()
void visitConfigBuilderField(ClassElement type, String field, AnnotationMetadata annotationMetadata, ConfigurationMetadataBuilder<?> metadataBuilder, boolean isInterface)
type
- The type of the builderfield
- The name of the field that represents the builderannotationMetadata
- The annotation metadata associated with the fieldmetadataBuilder
- The ConfigurationMetadataBuilder
isInterface
- Whether the builder type is an interface or notConfigurationBuilder
void visitConfigBuilderMethod(ClassElement type, String methodName, AnnotationMetadata annotationMetadata, ConfigurationMetadataBuilder<?> metadataBuilder, boolean isInterface)
type
- The type of the buildermethodName
- The name of the method that returns the builderannotationMetadata
- The annotation metadata associated with the fieldmetadataBuilder
- The ConfigurationMetadataBuilder
isInterface
- Whether the builder type is an interface or notConfigurationBuilder
void visitConfigBuilderMethod(String prefix, ClassElement returnType, String methodName, @Nullable ClassElement paramType, Map<String,ClassElement> generics, String path)
prefix
- The prefix used for the methodreturnType
- The return typemethodName
- The method nameparamType
- The method typegenerics
- The generic types of the methodpath
- The property pathConfigurationBuilder
void visitConfigBuilderDurationMethod(String prefix, ClassElement returnType, String methodName, String path)
prefix
- The prefix used for the methodreturnType
- The return typemethodName
- The method namepath
- The property pathConfigurationBuilder
void visitConfigBuilderEnd()
ConfigurationBuilder
default boolean requiresMethodProcessing()
BeanContext
is started, the
BeanDefinition.getExecutableMethods()
are not processed by registered
ExecutableMethodProcessor
instances unless this method returns true.Executable.processOnStartup()
void setRequiresMethodProcessing(boolean shouldPreProcess)
BeanType.requiresMethodProcessing()
returns true.shouldPreProcess
- True if they should be pre-processedvoid visitTypeArguments(Map<String,Map<String,ClassElement>> typeArguments)
typeArguments
- The type arguments@NonNull default ClassElement[] getTypeArguments()