Package org.infinispan.protostream.impl
Class AnnotatedDescriptorImpl
java.lang.Object
org.infinispan.protostream.impl.AnnotatedDescriptorImpl
- All Implemented Interfaces:
AnnotatedDescriptor
- Direct Known Subclasses:
FieldDescriptor,ReservableDescriptor
- Since:
- 2.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Map<String, AnnotationElement.Annotation> The annotations found in the documentation.protected final StringThe (optional) documentation comment.protected Stringprivate static final Logprotected final StringThe annotation metadata objects created by theAnnotationMetadataCreatorbased on the annotations found in the documentation text. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAnnotatedDescriptorImpl(String name, String fullName, String documentation) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract AnnotationConfigurationgetAnnotationConfig(AnnotationElement.Annotation annotation) Subclasses are responsible for fetching theAnnotationConfigurationfrom the appropriate config (it it exists) and to validate that the target is suitable.protected Configuration.AnnotationsConfigfinal StringReturn the documentation text associated with this descriptor.final StringReturn the full name of the descriptor.final StringgetName()Return the name of the descriptor.<T> TgetProcessedAnnotation(String annotationName) Get the 'processed' annotation object created by the registeredAnnotationMetadataCreatorornullif the annotation is missing or noAnnotationMetadataCreatorwas registered.private voidnormalizeValues(AnnotationElement.Annotation annotation, AnnotationConfiguration annotationConfig) private voidExtract annotations by parsing the documentation comment and run the configuredAnnotationMetadataCreators.private voidvalidateAttribute(AnnotationElement.Annotation annotation, AnnotationElement.Attribute attribute, AnnotationAttributeConfiguration attributeConfig, AnnotationElement.Value value) private voidvalidateAttributes(AnnotationElement.Annotation annotation, AnnotationConfiguration annotationConfig) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.infinispan.protostream.descriptors.AnnotatedDescriptor
getFileDescriptor
-
Field Details
-
log
-
name
-
fullName
-
documentation
The (optional) documentation comment. -
annotations
The annotations found in the documentation. -
processedAnnotations
The annotation metadata objects created by theAnnotationMetadataCreatorbased on the annotations found in the documentation text.
-
-
Constructor Details
-
AnnotatedDescriptorImpl
-
-
Method Details
-
getName
Description copied from interface:AnnotatedDescriptorReturn the name of the descriptor.- Specified by:
getNamein interfaceAnnotatedDescriptor- Returns:
- the name of the descriptor (never
null)
-
getFullName
Description copied from interface:AnnotatedDescriptorReturn the full name of the descriptor.- Specified by:
getFullNamein interfaceAnnotatedDescriptor- Returns:
- the name of the descriptor (never
null)
-
getDocumentation
Description copied from interface:AnnotatedDescriptorReturn the documentation text associated with this descriptor.- Specified by:
getDocumentationin interfaceAnnotatedDescriptor- Returns:
- the documentation text or
nullif not present
-
processAnnotations
Extract annotations by parsing the documentation comment and run the configuredAnnotationMetadataCreators.- Throws:
AnnotationParserException- if annotation parsing fails
-
validateAttributes
private void validateAttributes(AnnotationElement.Annotation annotation, AnnotationConfiguration annotationConfig) -
validateAttribute
private void validateAttribute(AnnotationElement.Annotation annotation, AnnotationElement.Attribute attribute, AnnotationAttributeConfiguration attributeConfig, AnnotationElement.Value value) -
normalizeValues
private void normalizeValues(AnnotationElement.Annotation annotation, AnnotationConfiguration annotationConfig) -
getAnnotationsConfig
-
getAnnotationConfig
protected abstract AnnotationConfiguration getAnnotationConfig(AnnotationElement.Annotation annotation) throws DescriptorParserException Subclasses are responsible for fetching theAnnotationConfigurationfrom the appropriate config (it it exists) and to validate that the target is suitable.- Returns:
- null if the annotation is not found
- Throws:
DescriptorParserException- is the annotation target is not suitable for this descriptor
-
getAnnotations
- Specified by:
getAnnotationsin interfaceAnnotatedDescriptor- Throws:
AnnotationParserException
-
getProcessedAnnotation
Description copied from interface:AnnotatedDescriptorGet the 'processed' annotation object created by the registeredAnnotationMetadataCreatorornullif the annotation is missing or noAnnotationMetadataCreatorwas registered.- Specified by:
getProcessedAnnotationin interfaceAnnotatedDescriptor- Type Parameters:
T- the expected type of the object created by theAnnotationMetadataCreator- Parameters:
annotationName- the name of the annotation- Returns:
- the 'processed' annotation object or
nullif not found - Throws:
AnnotationParserException- if parsing of annotations fails
-