public interface BeanDefinitionVisitor
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() |
Element |
getOriginatingElement() |
java.lang.String |
getPackageName() |
org.objectweb.asm.Type |
getProvidedType()
The provided type of the bean.
|
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 |
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(AnnotationMetadata annotationMetadata,
boolean requiresReflection)
Visits a no arguments constructor.
|
void |
visitBeanDefinitionConstructor(AnnotationMetadata annotationMetadata,
boolean requiresReflection,
java.util.Map<java.lang.String,java.lang.Object> argumentTypes,
java.util.Map<java.lang.String,AnnotationMetadata> argumentAnnotationMetadata,
java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> genericTypes)
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,
java.lang.Object 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(java.lang.Object type,
java.lang.String field,
AnnotationMetadata annotationMetadata,
ConfigurationMetadataBuilder metadataBuilder,
boolean isInterface)
Begin defining a configuration builder.
|
void |
visitConfigBuilderMethod(java.lang.Object type,
java.lang.String methodName,
AnnotationMetadata annotationMetadata,
ConfigurationMetadataBuilder metadataBuilder,
boolean isInterface)
Begin defining a configuration builder.
|
void |
visitConfigBuilderMethod(java.lang.String prefix,
java.lang.Object returnType,
java.lang.String methodName,
java.lang.Object paramType,
java.util.Map<java.lang.String,java.lang.Object> generics,
java.lang.String path)
Visit a configuration builder method.
|
ExecutableMethodWriter |
visitExecutableMethod(java.lang.Object declaringType,
java.lang.Object returnType,
java.lang.Object genericReturnType,
java.util.Map<java.lang.String,java.lang.Object> returnTypeGenericTypes,
java.lang.String methodName,
java.util.Map<java.lang.String,java.lang.Object> argumentTypes,
java.util.Map<java.lang.String,java.lang.Object> genericArgumentTypes,
java.util.Map<java.lang.String,AnnotationMetadata> argumentAnnotationMetadata,
java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> genericTypes,
AnnotationMetadata annotationMetadata,
boolean isInterface,
boolean isDefault)
Visit a method that is to be made executable allow invocation of said method without reflection.
|
void |
visitFieldInjectionPoint(java.lang.Object declaringType,
java.lang.Object fieldType,
java.lang.String fieldName,
boolean requiresReflection,
AnnotationMetadata annotationMetadata,
java.util.Map<java.lang.String,java.lang.Object> typeArguments)
Visits a field injection point.
|
void |
visitFieldValue(java.lang.Object declaringType,
java.lang.Object fieldType,
java.lang.String fieldName,
boolean requiresReflection,
AnnotationMetadata annotationMetadata,
java.util.Map<java.lang.String,java.lang.Object> typeArguments,
boolean isOptional)
Visits a field injection point.
|
void |
visitMethodInjectionPoint(java.lang.Object declaringType,
boolean requiresReflection,
java.lang.Object returnType,
java.lang.String methodName,
java.util.Map<java.lang.String,java.lang.Object> argumentTypes,
java.util.Map<java.lang.String,AnnotationMetadata> argumentAnnotationMetadata,
java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> genericTypes,
AnnotationMetadata annotationMetadata)
Visits a method injection point.
|
void |
visitPostConstructMethod(java.lang.Object declaringType,
boolean requiresReflection,
java.lang.Object returnType,
java.lang.String methodName,
java.util.Map<java.lang.String,java.lang.Object> argumentTypes,
java.util.Map<java.lang.String,AnnotationMetadata> argumentAnnotationMetadata,
java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> genericTypes,
AnnotationMetadata annotationMetadata)
Visits a method injection point.
|
void |
visitPreDestroyMethod(java.lang.Object declaringType,
boolean requiresReflection,
java.lang.Object returnType,
java.lang.String methodName,
java.util.Map<java.lang.String,java.lang.Object> argumentTypes,
java.util.Map<java.lang.String,AnnotationMetadata> argumentAnnotationMetadata,
java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> genericTypes,
AnnotationMetadata annotationMetadata)
Visits a method injection point.
|
void |
visitSetterValue(java.lang.Object declaringType,
java.lang.Object returnType,
AnnotationMetadata methodMetadata,
boolean requiresReflection,
java.lang.Object valueType,
java.lang.String setterName,
java.util.Map<java.lang.String,java.lang.Object> genericTypes,
AnnotationMetadata setterArgumentMetadata,
boolean isOptional)
Visits an injection point for a setter.
|
void |
visitSetterValue(java.lang.Object declaringType,
java.lang.Object returnType,
AnnotationMetadata annotationMetadata,
boolean requiresReflection,
java.lang.Object fieldType,
java.lang.String fieldName,
java.lang.String setterName,
java.util.Map<java.lang.String,java.lang.Object> genericTypes,
boolean isOptional)
Visits an injection point for a field and setter pairing.
|
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,java.lang.Object>> 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.
|
static final java.lang.String PROXY_SUFFIX
@Nullable Element getOriginatingElement()
void visitBeanDefinitionConstructor(AnnotationMetadata annotationMetadata, boolean requiresReflection)
visitBeanDefinitionConstructor(AnnotationMetadata, boolean, Map, Map, Map)
should be called at least
once.annotationMetadata
- The annotation metadata for the constructor.requiresReflection
- Whether invoking the constructor requires reflection.void visitBeanDefinitionConstructor(AnnotationMetadata annotationMetadata, boolean requiresReflection, java.util.Map<java.lang.String,java.lang.Object> argumentTypes, java.util.Map<java.lang.String,AnnotationMetadata> argumentAnnotationMetadata, java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> genericTypes)
annotationMetadata
- The annotation metadata for the constructorrequiresReflection
- Whether invoking the constructor requires reflectionargumentTypes
- The argument type names for each parameterargumentAnnotationMetadata
- The argument annotation metadatagenericTypes
- The generic types for each parameter@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 validatedboolean 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(java.lang.Object declaringType, java.lang.Object returnType, AnnotationMetadata annotationMetadata, boolean requiresReflection, java.lang.Object fieldType, java.lang.String fieldName, java.lang.String setterName, java.util.Map<java.lang.String,java.lang.Object> genericTypes, boolean isOptional)
declaringType
- The declaring typereturnType
- The return typeannotationMetadata
- The annotation metadatarequiresReflection
- Whether the setter requires reflectionfieldType
- The field typefieldName
- The field namesetterName
- The setter namegenericTypes
- The generic typesisOptional
- Whether the setter is optionalvoid visitSetterValue(java.lang.Object declaringType, java.lang.Object returnType, AnnotationMetadata methodMetadata, boolean requiresReflection, java.lang.Object valueType, java.lang.String setterName, java.util.Map<java.lang.String,java.lang.Object> genericTypes, AnnotationMetadata setterArgumentMetadata, boolean isOptional)
declaringType
- The declaring typereturnType
- The return typemethodMetadata
- The annotation metadatarequiresReflection
- Whether the setter requires reflectionvalueType
- The field typesetterName
- The setter namegenericTypes
- The generic typessetterArgumentMetadata
- The setter argument metadataisOptional
- Whether the setter is optionalvoid visitPostConstructMethod(java.lang.Object declaringType, boolean requiresReflection, java.lang.Object returnType, java.lang.String methodName, java.util.Map<java.lang.String,java.lang.Object> argumentTypes, java.util.Map<java.lang.String,AnnotationMetadata> argumentAnnotationMetadata, java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> genericTypes, AnnotationMetadata annotationMetadata)
declaringType
- The declaring type of the method. Either a Class or a string representing
the name of the typerequiresReflection
- Whether the method requires reflectionreturnType
- The return type of the method. Either a Class or a string representing the
name of the typemethodName
- The method nameargumentTypes
- The argument types. Note: an ordered map should be used such as LinkedHashMap.
Can be null or empty.argumentAnnotationMetadata
- The argument annotation metadatagenericTypes
- The generic types of each argument. Can be null.annotationMetadata
- The annotation metadatavoid visitPreDestroyMethod(java.lang.Object declaringType, boolean requiresReflection, java.lang.Object returnType, java.lang.String methodName, java.util.Map<java.lang.String,java.lang.Object> argumentTypes, java.util.Map<java.lang.String,AnnotationMetadata> argumentAnnotationMetadata, java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> genericTypes, AnnotationMetadata annotationMetadata)
declaringType
- The declaring type of the method. Either a Class or a string representing the
name of the typerequiresReflection
- Whether the method requires reflectionreturnType
- The return type of the method. Either a Class or a string representing the name
of the typemethodName
- The method nameargumentTypes
- The argument types. Note: an ordered map should be used such as LinkedHashMap.
Can be null or empty.argumentAnnotationMetadata
- The argument annotation metadatagenericTypes
- The generic types of each argument. Can be null.annotationMetadata
- The annotation metadatavoid visitMethodInjectionPoint(java.lang.Object declaringType, boolean requiresReflection, java.lang.Object returnType, java.lang.String methodName, java.util.Map<java.lang.String,java.lang.Object> argumentTypes, java.util.Map<java.lang.String,AnnotationMetadata> argumentAnnotationMetadata, java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> genericTypes, AnnotationMetadata annotationMetadata)
declaringType
- The declaring type of the method. Either a Class or a string representing the
name of the typerequiresReflection
- Whether the method requires reflectionreturnType
- The return type of the method. Either a Class or a string representing the name
of the typemethodName
- The method nameargumentTypes
- The argument types. Note: an ordered map should be used such as LinkedHashMap.
Can be null or empty.argumentAnnotationMetadata
- The argument annotation metadatagenericTypes
- The generic types of each argument. Can be null.annotationMetadata
- The annotation metadataExecutableMethodWriter visitExecutableMethod(java.lang.Object declaringType, java.lang.Object returnType, java.lang.Object genericReturnType, java.util.Map<java.lang.String,java.lang.Object> returnTypeGenericTypes, java.lang.String methodName, java.util.Map<java.lang.String,java.lang.Object> argumentTypes, java.util.Map<java.lang.String,java.lang.Object> genericArgumentTypes, java.util.Map<java.lang.String,AnnotationMetadata> argumentAnnotationMetadata, java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> genericTypes, @Nullable AnnotationMetadata annotationMetadata, boolean isInterface, boolean isDefault)
declaringType
- The declaring type of the method. Either a Class or a string representing the
name of the typereturnType
- The return type of the method. Either a Class or a string representing the name
of the typegenericReturnType
- The generic return typereturnTypeGenericTypes
- The return type for generic typesmethodName
- The method nameargumentTypes
- The argument types. Note: an ordered map should be used such as LinkedHashMap.
Can be null or empty.genericArgumentTypes
- The generic argument types. Note: an ordered map should be used such as LinkedHashMap.
Can be null or empty.argumentAnnotationMetadata
- The argument annotation metadatagenericTypes
- The generic types of each argument. Can be null.annotationMetadata
- The annotation metadata for the methodisInterface
- If the method belongs to an interfaceisDefault
- If the method is a default methodExecutableMethodWriter
.void visitFieldInjectionPoint(java.lang.Object declaringType, java.lang.Object fieldType, java.lang.String fieldName, boolean requiresReflection, @Nullable AnnotationMetadata annotationMetadata, @Nullable java.util.Map<java.lang.String,java.lang.Object> typeArguments)
declaringType
- The declaring type. Either a Class or a string representing the name of the typefieldType
- The type of the fieldfieldName
- The name of the fieldrequiresReflection
- Whether accessing the field requires reflectionannotationMetadata
- The annotation metadata for the fieldtypeArguments
- The generic type argumentsvoid visitFieldValue(java.lang.Object declaringType, java.lang.Object fieldType, java.lang.String fieldName, boolean requiresReflection, @Nullable AnnotationMetadata annotationMetadata, @Nullable java.util.Map<java.lang.String,java.lang.Object> typeArguments, boolean isOptional)
declaringType
- The declaring type. Either a Class or a string representing the name of the typefieldType
- The type of the fieldfieldName
- The name of the fieldrequiresReflection
- Whether accessing the field requires reflectionannotationMetadata
- The annotation metadata for the fieldtypeArguments
- The generic type argumentsisOptional
- Is the value optionaljava.lang.String getPackageName()
java.lang.String getBeanSimpleName()
AnnotationMetadata getAnnotationMetadata()
void visitConfigBuilderField(java.lang.Object 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(java.lang.Object 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, java.lang.Object returnType, java.lang.String methodName, java.lang.Object paramType, java.util.Map<java.lang.String,java.lang.Object> 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, java.lang.Object 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,java.lang.Object>> typeArguments)
typeArguments
- The type arguments