Package org.infinispan.protostream.impl
Class AnnotatedDescriptorImpl
- java.lang.Object
-
- org.infinispan.protostream.impl.AnnotatedDescriptorImpl
-
- All Implemented Interfaces:
AnnotatedDescriptor
- Direct Known Subclasses:
Descriptor,EnumDescriptor,FieldDescriptor
public abstract class AnnotatedDescriptorImpl extends Object implements AnnotatedDescriptor
- Since:
- 2.0
- Author:
- anistor@redhat.com
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,AnnotationElement.Annotation>annotationsThe annotations found in the documentation.protected StringdocumentationThe (optional) documentation comment.protected StringfullNameprotected Stringnameprotected Map<String,Object>processedAnnotationsThe annotation metadata objects created by theAnnotationMetadataCreatorbased on the annotations found in the documentation text.
-
Constructor Summary
Constructors Modifier Constructor Description protectedAnnotatedDescriptorImpl(String name, String fullName, String documentation)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected 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.Map<String,AnnotationElement.Annotation>getAnnotations()Get the documentation annotations in the form of a map of abstract syntax trees ofAnnotationElementnodes.protected Configuration.AnnotationsConfiggetAnnotationsConfig()StringgetDocumentation()Return the documentation text associated with this descriptor.StringgetFullName()Return the full name of the descriptor.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.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.infinispan.protostream.descriptors.AnnotatedDescriptor
getFileDescriptor
-
-
-
-
Field Detail
-
name
protected final String name
-
fullName
protected String fullName
-
documentation
protected final String documentation
The (optional) documentation comment.
-
annotations
protected Map<String,AnnotationElement.Annotation> annotations
The annotations found in the documentation.
-
processedAnnotations
protected Map<String,Object> processedAnnotations
The annotation metadata objects created by theAnnotationMetadataCreatorbased on the annotations found in the documentation text.
-
-
Method Detail
-
getName
public final String getName()
Description copied from interface:AnnotatedDescriptorReturn the name of the descriptor.- Specified by:
getNamein interfaceAnnotatedDescriptor- Returns:
- the name of the descriptor (never
null)
-
getFullName
public final String 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
public final String 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
-
getAnnotationsConfig
protected Configuration.AnnotationsConfig 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
public Map<String,AnnotationElement.Annotation> getAnnotations() throws AnnotationParserException
Description copied from interface:AnnotatedDescriptorGet the documentation annotations in the form of a map of abstract syntax trees ofAnnotationElementnodes. Only the configured annotations are returned. The unconfigured ones are discarded immediately after parsing.The parsing of annotations is performed lazily on first invocation.
- Specified by:
getAnnotationsin interfaceAnnotatedDescriptor- Returns:
- the map of annotations
- Throws:
AnnotationParserException- if parsing of annotations fails
-
getProcessedAnnotation
public <T> T getProcessedAnnotation(String annotationName) throws AnnotationParserException
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
-
-