Interface MappingAnnotationProcessorContext
-
- All Known Subinterfaces:
ConstructorMappingAnnotationProcessorContext,MethodParameterMappingAnnotationProcessorContext,PropertyMappingAnnotationProcessorContext,TypeMappingAnnotationProcessorContext
- All Known Implementing Classes:
AbstractMappingAnnotationProcessorContext,ConstructorMappingAnnotationProcessorContextImpl,MethodParameterMappingAnnotationProcessorContextImpl,PropertyMappingAnnotationProcessorContextImpl,TypeMappingAnnotationProcessorContextImpl
public interface MappingAnnotationProcessorContextA superinterface for contexts passed to mapping annotation processors.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description MappingAnnotatedElementannotatedElement()EventContexteventContext()default <T> Optional<BeanReference<? extends T>>toBeanReference(Class<T> expectedType, Class<?> undefinedTypeMarker, Class<? extends T> type, String name)<T> Optional<BeanReference<? extends T>>toBeanReference(Class<T> expectedType, Class<?> undefinedTypeMarker, Class<? extends T> type, String name, BeanRetrieval retrieval)Convert attributes of a bean-reference annotation, such asValueBridgeRef, to an actualBeanReference.ContainerExtractorPathtoContainerExtractorPath(ContainerExtraction extraction)Convert aContainerExtractionannotation to aContainerExtractorPath.default Map<String,Object>toMap(Param[] params)<T> TtoNullIfDefault(T value, T defaultValue)Optional<PojoModelPathValueNode>toPojoModelPathValueNode(ObjectPath objectPath)Convert anObjectPathannotation to aPojoModelPathValueNode.
-
-
-
Method Detail
-
annotatedElement
MappingAnnotatedElement annotatedElement()
- Returns:
- A representation of the annotated element.
-
toPojoModelPathValueNode
Optional<PojoModelPathValueNode> toPojoModelPathValueNode(ObjectPath objectPath)
Convert anObjectPathannotation to aPojoModelPathValueNode.- Parameters:
objectPath- The annotation to convert.- Returns:
- The corresponding path, or an empty optional if the path was empty.
-
toContainerExtractorPath
ContainerExtractorPath toContainerExtractorPath(ContainerExtraction extraction)
Convert aContainerExtractionannotation to aContainerExtractorPath.- Parameters:
extraction- The annotation to convert.- Returns:
- The corresponding path.
-
toBeanReference
default <T> Optional<BeanReference<? extends T>> toBeanReference(Class<T> expectedType, Class<?> undefinedTypeMarker, Class<? extends T> type, String name)
- Type Parameters:
T- The bean type.- Parameters:
expectedType- The supertype of all types that can be referenced.undefinedTypeMarker- A marker type to detect that thetypeparameter has its default value (undefined).type- The bean type.name- The bean name.- Returns:
- The corresponding bean reference, or an empty optional if neither the type nor the name is provided.
-
toBeanReference
<T> Optional<BeanReference<? extends T>> toBeanReference(Class<T> expectedType, Class<?> undefinedTypeMarker, Class<? extends T> type, String name, BeanRetrieval retrieval)
Convert attributes of a bean-reference annotation, such asValueBridgeRef, to an actualBeanReference.Example of use:
Optional<BeanReference<? extends ValueBridge>> valueBridgeRef = toBeanReference( ValueBridge.class, ValueBridgeRef.UndefinedBridgeImplementationType.class, myValueBridgeRefInstance.type(), myValueBridgeRefInstance.name(), myValueBridgeRefInstance.retrieval() );- Type Parameters:
T- The bean type.- Parameters:
expectedType- The supertype of all types that can be referenced.undefinedTypeMarker- A marker type to detect that thetypeparameter has its default value (undefined).type- The bean type.name- The bean name.retrieval- How to retrieve the bean. SeeBeanRetrieval.- Returns:
- The corresponding bean reference, or an empty optional if neither the type nor the name is provided.
-
eventContext
EventContext eventContext()
- Returns:
- An event context describing the annotation being processed and its location, for use in log messages and exception messages.
-
toMap
default Map<String,Object> toMap(Param[] params)
- Parameters:
params- The original params- Returns:
- A
Mapcreated fromParamusingParam.name()as key andParam.value()as value - Throws:
SearchException- ifparamscontain multiple parameters with the sameParam.name()
-
toNullIfDefault
<T> T toNullIfDefault(T value, T defaultValue)- Parameters:
value- A value extracted from an annotation attribute.defaultValue- A default value for that annotation attribute.- Returns:
nullifvalueisequaltodefaultValue,valueotherwise.
-
-