Package io.protostuff.parser
Class AnnotationContainer
- java.lang.Object
-
- io.protostuff.parser.AnnotationContainer
-
- All Implemented Interfaces:
HasAnnotations
,HasProto
- Direct Known Subclasses:
EnumGroup
,EnumGroup.Value
,Extension
,Field
,Message
,Proto
,Service
,Service.RpcMethod
public abstract class AnnotationContainer extends java.lang.Object implements HasAnnotations, HasProto
Base class for components that contain annotations.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.util.LinkedHashMap<java.lang.String,Annotation>
annotations
(package private) java.util.ArrayList<java.lang.String>
docs
-
Constructor Summary
Constructors Constructor Description AnnotationContainer()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(Annotation annotation)
Adds the annoation.boolean
addAnnotations(java.util.Map<java.lang.String,Annotation> source, boolean clearSource)
Adds all the annotations to this container.void
addDoc(java.lang.String doc)
static java.lang.IllegalStateException
err(java.lang.String msg, Proto proto)
java.util.Map<java.lang.String,Annotation>
getA()
Short-hand forgetAnnotationMap()
.Annotation
getAnnotation(java.lang.String name)
Gets the annotation by key/name.java.util.Map<java.lang.String,Annotation>
getAnnotationMap()
Gets the annotation map.java.util.Collection<Annotation>
getAnnotations()
Gets the annotations.java.util.ArrayList<java.lang.String>
getDocs()
boolean
hasAnnotation(java.lang.String name)
boolean
isEmptyA()
Shorthand for annotations.isEmpty().
-
-
-
Field Detail
-
annotations
final java.util.LinkedHashMap<java.lang.String,Annotation> annotations
-
docs
final java.util.ArrayList<java.lang.String> docs
-
-
Method Detail
-
getDocs
public java.util.ArrayList<java.lang.String> getDocs()
-
addDoc
public void addDoc(java.lang.String doc)
-
add
public void add(Annotation annotation)
Description copied from interface:HasAnnotations
Adds the annoation.- Specified by:
add
in interfaceHasAnnotations
-
getAnnotationMap
public java.util.Map<java.lang.String,Annotation> getAnnotationMap()
Description copied from interface:HasAnnotations
Gets the annotation map.- Specified by:
getAnnotationMap
in interfaceHasAnnotations
-
getA
public final java.util.Map<java.lang.String,Annotation> getA()
-
getAnnotations
public java.util.Collection<Annotation> getAnnotations()
Description copied from interface:HasAnnotations
Gets the annotations.- Specified by:
getAnnotations
in interfaceHasAnnotations
-
getAnnotation
public Annotation getAnnotation(java.lang.String name)
Description copied from interface:HasAnnotations
Gets the annotation by key/name.- Specified by:
getAnnotation
in interfaceHasAnnotations
-
hasAnnotation
public boolean hasAnnotation(java.lang.String name)
-
addAnnotations
public boolean addAnnotations(java.util.Map<java.lang.String,Annotation> source, boolean clearSource)
Description copied from interface:HasAnnotations
Adds all the annotations to this container. IfclearSource
is true, thesource
arg is cleared.- Specified by:
addAnnotations
in interfaceHasAnnotations
-
isEmptyA
public final boolean isEmptyA()
Shorthand for annotations.isEmpty().You can then use: <if(message.emptyA)>
Note that this does not work on stringtemplate: <if(message.annotationMap.empty)> Even though
Map.isEmpty()
exists.
-
err
public static java.lang.IllegalStateException err(java.lang.String msg, Proto proto)
-
-