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 voidadd(Annotation annotation)Adds the annoation.booleanaddAnnotations(java.util.Map<java.lang.String,Annotation> source, boolean clearSource)Adds all the annotations to this container.voidaddDoc(java.lang.String doc)static java.lang.IllegalStateExceptionerr(java.lang.String msg, Proto proto)java.util.Map<java.lang.String,Annotation>getA()Short-hand forgetAnnotationMap().AnnotationgetAnnotation(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()booleanhasAnnotation(java.lang.String name)booleanisEmptyA()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:HasAnnotationsAdds the annoation.- Specified by:
addin interfaceHasAnnotations
-
getAnnotationMap
public java.util.Map<java.lang.String,Annotation> getAnnotationMap()
Description copied from interface:HasAnnotationsGets the annotation map.- Specified by:
getAnnotationMapin interfaceHasAnnotations
-
getA
public final java.util.Map<java.lang.String,Annotation> getA()
-
getAnnotations
public java.util.Collection<Annotation> getAnnotations()
Description copied from interface:HasAnnotationsGets the annotations.- Specified by:
getAnnotationsin interfaceHasAnnotations
-
getAnnotation
public Annotation getAnnotation(java.lang.String name)
Description copied from interface:HasAnnotationsGets the annotation by key/name.- Specified by:
getAnnotationin 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:HasAnnotationsAdds all the annotations to this container. IfclearSourceis true, thesourcearg is cleared.- Specified by:
addAnnotationsin 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)
-
-