public interface BeanDefinitionVisitor
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 |
getBeanSimpleName() |
String |
getBeanTypeName() |
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,
Map<String,Object> argumentTypes,
Map<String,AnnotationMetadata> argumentAnnotationMetadata,
Map<String,Map<String,Object>> genericTypes)
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,
String configurationPrefix,
Object returnType,
String methodName)
Visit a configuration builder method that accepts a long and a TimeUnit.
|
void |
visitConfigBuilderEnd()
Finalize a configuration builder field.
|
void |
visitConfigBuilderField(Object type,
String field,
AnnotationMetadata annotationMetadata,
ConfigurationMetadataBuilder metadataBuilder)
Begin defining a configuration builder.
|
void |
visitConfigBuilderMethod(Object type,
String methodName,
AnnotationMetadata annotationMetadata,
ConfigurationMetadataBuilder metadataBuilder)
Begin defining a configuration builder.
|
void |
visitConfigBuilderMethod(String prefix,
String configurationPrefix,
Object returnType,
String methodName,
Object paramType,
Map<String,Object> generics)
Visit a configuration builder method.
|
ExecutableMethodWriter |
visitExecutableMethod(Object declaringType,
Object returnType,
Object genericReturnType,
Map<String,Object> returnTypeGenericTypes,
String methodName,
Map<String,Object> argumentTypes,
Map<String,Object> genericArgumentTypes,
Map<String,AnnotationMetadata> argumentAnnotationMetadata,
Map<String,Map<String,Object>> genericTypes,
AnnotationMetadata annotationMetadata)
Visit a method that is to be made executable allow invocation of said method without reflection.
|
void |
visitFieldInjectionPoint(Object declaringType,
Object fieldType,
String fieldName,
boolean requiresReflection,
AnnotationMetadata annotationMetadata,
Map<String,Object> typeArguments)
Visits a field injection point.
|
void |
visitFieldValue(Object declaringType,
Object fieldType,
String fieldName,
boolean requiresReflection,
AnnotationMetadata annotationMetadata,
Map<String,Object> typeArguments,
boolean isOptional)
Visits a field injection point.
|
void |
visitMethodInjectionPoint(Object declaringType,
boolean requiresReflection,
Object returnType,
String methodName,
Map<String,Object> argumentTypes,
Map<String,AnnotationMetadata> argumentAnnotationMetadata,
Map<String,Map<String,Object>> genericTypes,
AnnotationMetadata annotationMetadata)
Visits a method injection point.
|
void |
visitPostConstructMethod(Object declaringType,
boolean requiresReflection,
Object returnType,
String methodName,
Map<String,Object> argumentTypes,
Map<String,AnnotationMetadata> argumentAnnotationMetadata,
Map<String,Map<String,Object>> genericTypes,
AnnotationMetadata annotationMetadata)
Visits a method injection point.
|
void |
visitPreDestroyMethod(Object declaringType,
boolean requiresReflection,
Object returnType,
String methodName,
Map<String,Object> argumentTypes,
Map<String,AnnotationMetadata> argumentAnnotationMetadata,
Map<String,Map<String,Object>> genericTypes,
AnnotationMetadata annotationMetadata)
Visits a method injection point.
|
void |
visitSetterValue(Object declaringType,
AnnotationMetadata methodMetadata,
boolean requiresReflection,
Object valueType,
String setterName,
Map<String,Object> genericTypes,
AnnotationMetadata setterArgumentMetadata,
boolean isOptional)
Visits an injection point for a setter.
|
void |
visitSetterValue(Object declaringType,
AnnotationMetadata annotationMetadata,
boolean requiresReflection,
Object fieldType,
String fieldName,
String setterName,
Map<String,Object> genericTypes,
boolean isOptional)
Visits an injection point for a field and setter pairing.
|
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,Object>> typeArguments)
Visits the type arguments for the bean.
|
void |
writeTo(File compilationDir)
Write the state of the writer to the given compilation directory.
|
static final String PROXY_SUFFIX
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, Map<String,Object> argumentTypes, Map<String,AnnotationMetadata> argumentAnnotationMetadata, Map<String,Map<String,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 parameterboolean 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 validatedboolean 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(Object declaringType, AnnotationMetadata annotationMetadata, boolean requiresReflection, Object fieldType, String fieldName, String setterName, Map<String,Object> genericTypes, boolean isOptional)
declaringType
- The declaring 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(Object declaringType, AnnotationMetadata methodMetadata, boolean requiresReflection, Object valueType, String setterName, Map<String,Object> genericTypes, AnnotationMetadata setterArgumentMetadata, boolean isOptional)
declaringType
- The declaring 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(Object declaringType, boolean requiresReflection, Object returnType, String methodName, Map<String,Object> argumentTypes, Map<String,AnnotationMetadata> argumentAnnotationMetadata, Map<String,Map<String,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(Object declaringType, boolean requiresReflection, Object returnType, String methodName, Map<String,Object> argumentTypes, Map<String,AnnotationMetadata> argumentAnnotationMetadata, Map<String,Map<String,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(Object declaringType, boolean requiresReflection, Object returnType, String methodName, Map<String,Object> argumentTypes, Map<String,AnnotationMetadata> argumentAnnotationMetadata, Map<String,Map<String,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(Object declaringType, Object returnType, Object genericReturnType, Map<String,Object> returnTypeGenericTypes, String methodName, Map<String,Object> argumentTypes, Map<String,Object> genericArgumentTypes, Map<String,AnnotationMetadata> argumentAnnotationMetadata, Map<String,Map<String,Object>> genericTypes, @Nullable AnnotationMetadata annotationMetadata)
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 methodExecutableMethodWriter
.void visitFieldInjectionPoint(Object declaringType, Object fieldType, String fieldName, boolean requiresReflection, @Nullable AnnotationMetadata annotationMetadata, @Nullable Map<String,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(Object declaringType, Object fieldType, String fieldName, boolean requiresReflection, @Nullable AnnotationMetadata annotationMetadata, @Nullable Map<String,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 optionalString getPackageName()
String getBeanSimpleName()
AnnotationMetadata getAnnotationMetadata()
void visitConfigBuilderField(Object type, String field, AnnotationMetadata annotationMetadata, ConfigurationMetadataBuilder metadataBuilder)
type
- The type of the builderfield
- The name of the field that represents the builderannotationMetadata
- The annotation metadata associated with the fieldmetadataBuilder
- The ConfigurationMetadataBuilder
ConfigurationBuilder
void visitConfigBuilderMethod(Object type, String methodName, AnnotationMetadata annotationMetadata, ConfigurationMetadataBuilder metadataBuilder)
type
- The type of the buildermethodName
- The name of the method that returns the builderannotationMetadata
- The annotation metadata associated with the fieldmetadataBuilder
- The ConfigurationMetadataBuilder
ConfigurationBuilder
void visitConfigBuilderMethod(String prefix, String configurationPrefix, Object returnType, String methodName, Object paramType, Map<String,Object> generics)
prefix
- The prefix used for the methodconfigurationPrefix
- The prefix used to retrieve the configuration valuereturnType
- The return typemethodName
- The method nameparamType
- The method typegenerics
- The generic types of the methodConfigurationBuilder
void visitConfigBuilderDurationMethod(String prefix, String configurationPrefix, Object returnType, String methodName)
prefix
- The prefix used for the methodconfigurationPrefix
- The prefix used to retrieve the configuration valuereturnType
- The return typemethodName
- The method nameConfigurationBuilder
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-processed