public class GenericAnnotations extends InlineAnnotation implements Iterable<GenericAnnotation>
GenericAnnotation.
This annotation set assumes its data field is used to store a unique ID for the set.
This annotation can be used inline as well as on structural objects.
CLASSNAME_SEPARATOR, data| Constructor and Description |
|---|
GenericAnnotations()
Creates an empty annotation set.
|
GenericAnnotations(GenericAnnotation annotation)
Creates an annotation set and add a given one.
|
GenericAnnotations(String storage)
Creates an annotation set initialized with a storage string
created with
toString(). |
| Modifier and Type | Method and Description |
|---|---|
void |
add(GenericAnnotation annotation)
Adds an existing annotation to this object.
|
GenericAnnotation |
add(String type)
Creates an new annotation and add it to this object.
|
void |
addAll(GenericAnnotations annotations)
Adds all annotations of a given set of annotations to this object.
|
void |
addAll(List<GenericAnnotation> newItems)
Adds all the annotations from a given list to this object.
|
static void |
addAnnotations(Code code,
GenericAnnotations newSet)
Adds a set of annotations to a given inline code.
|
static void |
addAnnotations(IWithAnnotations nameable,
GenericAnnotations newSet)
Adds a set of annotations to a given INameable object (e.g.
|
void |
clear()
Removes all annotations from this list.
|
GenericAnnotations |
clone()
Clones this annotation and make sure its still has a unique ID.
|
static GenericAnnotations |
createFromString(String storage)
Creates a new GenericAnnotations object from a storage string.
|
void |
fromString(String storage)
Initializes this annotation from a storage string originally obtained
from
InlineAnnotation.toString(). |
List<GenericAnnotation> |
getAllAnnotations()
Gets the unmodifiable list of all the annotation in this annotation set.
|
List<GenericAnnotation> |
getAnnotations(String type)
Gets a list of all the annotations of a given type.
|
GenericAnnotation |
getFirstAnnotation(String type)
Gets the first occurrence of an annotation for a given type.
|
boolean |
hasAnnotation(String type)
Indicates if there is at least one annotation of a given type.
|
Iterator<GenericAnnotation> |
iterator() |
void |
remove(GenericAnnotation annotation)
Removes a given annotation from this list.
|
int |
size()
Gets the number of annotations in this annotation set.
|
String |
toString()
Gets a storage string representation of the whole annotation that can
be used for serialization.
|
getData, setDataequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic GenericAnnotations()
public GenericAnnotations(String storage)
toString().storage - the storage string to use.public GenericAnnotations(GenericAnnotation annotation)
annotation - the annotation to add.public static GenericAnnotations createFromString(String storage)
storage - the serialized representation of the object.public static void addAnnotations(IWithAnnotations nameable, GenericAnnotations newSet)
nameable - the object where to attached the new set.newSet - the new set to add (can be null: then nothing is attached).public static void addAnnotations(Code code, GenericAnnotations newSet)
code - the code where to add the annotation.newSet - the new set to add (can be null: then nothing is attached).public GenericAnnotations clone()
clone in interface IPersistentAnnotationclone in class InlineAnnotationpublic int size()
public List<GenericAnnotation> getAnnotations(String type)
The returned list is a new list but its items are the same as the items in the original list.
type - the type of annotation to look for.public GenericAnnotation getFirstAnnotation(String type)
type - the type of annotation to retrieve.public List<GenericAnnotation> getAllAnnotations()
public boolean hasAnnotation(String type)
type - the type of annotation to look for.public void clear()
public void remove(GenericAnnotation annotation)
annotation - the annotation to remove.public GenericAnnotation add(String type)
type - the type of annotation to create.public void add(GenericAnnotation annotation)
annotation - the annotation to add.public void addAll(GenericAnnotations annotations)
annotations - the set of annotations to add.public void addAll(List<GenericAnnotation> newItems)
newItems - the list of annotations to add.public String toString()
InlineAnnotationtoString in interface IAnnotationtoString in class InlineAnnotationpublic void fromString(String storage)
InlineAnnotationInlineAnnotation.toString().fromString in interface IPersistentAnnotationfromString in class InlineAnnotationstorage - The storage string to use for the initialization.public Iterator<GenericAnnotation> iterator()
iterator in interface Iterable<GenericAnnotation>Copyright © 2021. All rights reserved.