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:
- [email protected]
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,AnnotationElement.Annotation>
annotations
The annotations found in the documentation.protected String
documentation
The (optional) documentation comment.protected String
fullName
protected String
name
protected Map<String,Object>
processedAnnotations
The annotation metadata objects created by theAnnotationMetadataCreator
based on the annotations found in the documentation text.
-
Constructor Summary
Constructors Modifier Constructor Description protected
AnnotatedDescriptorImpl(String name, String fullName, String documentation)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract AnnotationConfiguration
getAnnotationConfig(AnnotationElement.Annotation annotation)
Subclasses are responsible for fetching theAnnotationConfiguration
from 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 ofAnnotationElement
nodes.protected Configuration.AnnotationsConfig
getAnnotationsConfig()
String
getDocumentation()
Return the documentation text associated with this descriptor.String
getFullName()
Return the full name of the descriptor.String
getName()
Return the name of the descriptor.<T> T
getProcessedAnnotation(String annotationName)
Get the 'processed' annotation object created by the registeredAnnotationMetadataCreator
ornull
if the annotation is missing or noAnnotationMetadataCreator
was 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 theAnnotationMetadataCreator
based on the annotations found in the documentation text.
-
-
Method Detail
-
getName
public final String getName()
Description copied from interface:AnnotatedDescriptor
Return the name of the descriptor.- Specified by:
getName
in interfaceAnnotatedDescriptor
- Returns:
- the name of the descriptor (never
null
)
-
getFullName
public final String getFullName()
Description copied from interface:AnnotatedDescriptor
Return the full name of the descriptor.- Specified by:
getFullName
in interfaceAnnotatedDescriptor
- Returns:
- the name of the descriptor (never
null
)
-
getDocumentation
public final String getDocumentation()
Description copied from interface:AnnotatedDescriptor
Return the documentation text associated with this descriptor.- Specified by:
getDocumentation
in interfaceAnnotatedDescriptor
- Returns:
- the documentation text or
null
if not present
-
getAnnotationsConfig
protected Configuration.AnnotationsConfig getAnnotationsConfig()
-
getAnnotationConfig
protected abstract AnnotationConfiguration getAnnotationConfig(AnnotationElement.Annotation annotation) throws DescriptorParserException
Subclasses are responsible for fetching theAnnotationConfiguration
from 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:AnnotatedDescriptor
Get the documentation annotations in the form of a map of abstract syntax trees ofAnnotationElement
nodes. 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:
getAnnotations
in 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:AnnotatedDescriptor
Get the 'processed' annotation object created by the registeredAnnotationMetadataCreator
ornull
if the annotation is missing or noAnnotationMetadataCreator
was registered.- Specified by:
getProcessedAnnotation
in 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
null
if not found - Throws:
AnnotationParserException
- if parsing of annotations fails
-
-