Package net.sf.okapi.common.resource
Interface IWithAnnotations
-
- All Known Subinterfaces:
IMultilingual,INameable,IResource,ITextUnit
- All Known Implementing Classes:
BaseNameable,BaseReferenceable,Custom,DocumentPart,Ending,EndSubfilter,MultiEvent,PipelineParameters,RawDocument,Segment,StartDocument,StartGroup,StartSubDocument,StartSubfilter,StorageList,TextContainer,TextPart,TextUnit
public interface IWithAnnotations
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default Iterator<IAnnotation>annotationIterator()Gets an iterator of the annotations for this resource.default voidclear()Empty allIAnnotation'sstatic voidcopy(IWithAnnotations from, IWithAnnotations to)Copy allIWithAnnotationsUnless destination already has the annotation.default <A extends IAnnotation>
AgetAnnotation(Class<A> annotationType)Gets the annotation object for a given class for this resource.AnnotationsgetAnnotations()default Set<Class<? extends IAnnotation>>getAnnotationsTypesAsSet()default <A extends IAnnotation>
booleanhasAnnotation(Class<A> annotationType)Does this resource have any annotations?default booleanhasAnnotations()Does this resource have any annotations?default <A extends IAnnotation>
voidremove(Class<A> annotationType)Remove the designatedIAnnotationdefault voidsetAnnotation(IAnnotation annotation)Sets an annotation object for this resource.
-
-
-
Method Detail
-
copy
static void copy(IWithAnnotations from, IWithAnnotations to)
Copy allIWithAnnotationsUnless destination already has the annotation.WARNING: Annotations are not cloned before copying.
IAnnotationshould define a clone method- Parameters:
from- source ofIWithAnnotationsto- destination ofIWithAnnotations
-
getAnnotations
Annotations getAnnotations()
- Returns:
Annotationsfor the implementer of interface
-
getAnnotation
default <A extends IAnnotation> A getAnnotation(Class<A> annotationType)
Gets the annotation object for a given class for this resource.- Type Parameters:
A-- Parameters:
annotation-- Returns:
-
setAnnotation
default void setAnnotation(IAnnotation annotation)
Sets an annotation object for this resource.- Parameters:
annotation- the annotation object to set.
-
annotationIterator
default Iterator<IAnnotation> annotationIterator()
Gets an iterator of the annotations for this resource.- Returns:
- an iterator list of the annotations for this resource.
-
getAnnotationsTypesAsSet
default Set<Class<? extends IAnnotation>> getAnnotationsTypesAsSet()
- Returns:
-
remove
default <A extends IAnnotation> void remove(Class<A> annotationType)
Remove the designatedIAnnotation- Type Parameters:
A-- Parameters:
annotationType- the class of the annotation object to retrieve.
-
hasAnnotations
default boolean hasAnnotations()
Does this resource have any annotations?- Returns:
- true if there are annotations on this
IResource
-
hasAnnotation
default <A extends IAnnotation> boolean hasAnnotation(Class<A> annotationType)
Does this resource have any annotations?- Type Parameters:
A-- Returns:
- true if there are annotations on this
IResource
-
clear
default void clear()
Empty allIAnnotation's
-
-