public interface BeanDefinitionVisitor extends OriginatingElements, Toggleable
BeanDefinitionVisitor
implementations such as BeanDefinitionWriter
.Modifier and Type | Field and Description |
---|---|
static java.lang.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() |
java.lang.String |
getBeanDefinitionName() |
java.lang.String |
getBeanDefinitionReferenceClassName() |
java.lang.String |
getBeanSimpleName() |
java.lang.String |
getBeanTypeName() |
java.util.Optional<org.objectweb.asm.Type> |
getInterceptedType() |
Element |
getOriginatingElement() |
java.lang.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(java.lang.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 |
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(java.lang.Class<? extends BeanDefinition> interfaceType)
Visit a marker interface on the generated bean definition.
|
void |
visitConfigBuilderDurationMethod(java.lang.String prefix,
ClassElement returnType,
java.lang.String methodName,
java.lang.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,
java.lang.String field,
AnnotationMetadata annotationMetadata,
ConfigurationMetadataBuilder metadataBuilder,
boolean isInterface)
Begin defining a configuration builder.
|
void |
visitConfigBuilderMethod(ClassElement type,
java.lang.String methodName,
AnnotationMetadata annotationMetadata,
ConfigurationMetadataBuilder metadataBuilder,
boolean isInterface)
Begin defining a configuration builder.
|
void |
visitConfigBuilderMethod(java.lang.String prefix,
ClassElement returnType,
java.lang.String methodName,
ClassElement paramType,
java.util.Map<java.lang.String,ClassElement> generics,
java.lang.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(java.lang.String name)
Alter the super class of this bean definition.
|
void |
visitSuperBeanDefinitionFactory(java.lang.String beanName)
Alter the super class of this bean definition to use another factory bean.
|
void |
visitTypeArguments(java.util.Map<java.lang.String,java.util.Map<java.lang.String,ClassElement>> typeArguments)
Visits the type arguments for the bean.
|
void |
writeTo(java.io.File compilationDir)
Write the state of the writer to the given compilation directory.
|
addOriginatingElement, getOriginatingElements, of
isEnabled
static final java.lang.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 java.lang.String getBeanDefinitionReferenceClassName()
boolean isInterface()
boolean isSingleton()
void visitBeanDefinitionInterface(java.lang.Class<? extends BeanDefinition> interfaceType)
interfaceType
- The interface typevoid visitSuperBeanDefinition(java.lang.String name)
AbstractBeanDefinition
.name
- The super typevoid visitSuperBeanDefinitionFactory(java.lang.String beanName)
beanName
- The bean namejava.lang.String 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(java.lang.String typeName)
typeName
- The type namejava.util.Optional<org.objectweb.asm.Type> getInterceptedType()
boolean isValidated()
java.lang.String getBeanDefinitionName()
void visitBeanDefinitionEnd()
void writeTo(java.io.File compilationDir) throws java.io.IOException
compilationDir
- The compilation directoryjava.io.IOException
- If an I/O error occursvoid accept(ClassWriterOutputVisitor visitor) throws java.io.IOException
visitor
- the writer output visitorjava.io.IOException
- 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 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 optionaljava.lang.String getPackageName()
java.lang.String getBeanSimpleName()
AnnotationMetadata getAnnotationMetadata()
void visitConfigBuilderField(ClassElement type, java.lang.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, java.lang.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(java.lang.String prefix, ClassElement returnType, java.lang.String methodName, @Nullable ClassElement paramType, java.util.Map<java.lang.String,ClassElement> generics, java.lang.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(java.lang.String prefix, ClassElement returnType, java.lang.String methodName, java.lang.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(java.util.Map<java.lang.String,java.util.Map<java.lang.String,ClassElement>> typeArguments)
typeArguments
- The type arguments@NonNull default ClassElement[] getTypeArguments()