Package net.sf.okapi.common.resource
Class InlineAnnotation
- java.lang.Object
-
- net.sf.okapi.common.resource.InlineAnnotation
-
- All Implemented Interfaces:
Cloneable,IAnnotation,IPersistentAnnotation
- Direct Known Subclasses:
GenericAnnotation,GenericAnnotations
public class InlineAnnotation extends Object implements IPersistentAnnotation
Base implementation of an annotation that can be used on inline codes. Inline annotations must have atoString()andfromString(String)methods to write and read themselves to and from a string.This basic annotation has only a string data. Its usage depends of the type of the annotation.
-
-
Field Summary
Fields Modifier and Type Field Description static StringCLASSNAME_SEPARATORprotected Stringdata
-
Constructor Summary
Constructors Constructor Description InlineAnnotation()Creates an empty annotation object.InlineAnnotation(String data)Creates a new annotation object with some initial data.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description InlineAnnotationclone()Clones this annotation.static InlineAnnotationcreateFromString(String storage)Creates a new InlineAnnotation object from a storage string.voidfromString(String storage)Initializes this annotation from a storage string originally obtained fromtoString().StringgetData()Gets the data for this annotation.voidsetData(String data)Sets the data for this annotation.StringtoString()Gets a storage string representation of the whole annotation that can be used for serialization.
-
-
-
Field Detail
-
CLASSNAME_SEPARATOR
public static final String CLASSNAME_SEPARATOR
- See Also:
- Constant Field Values
-
data
protected String data
-
-
Constructor Detail
-
InlineAnnotation
public InlineAnnotation()
Creates an empty annotation object.
-
InlineAnnotation
public InlineAnnotation(String data)
Creates a new annotation object with some initial data.- Parameters:
data- The data to set.
-
-
Method Detail
-
createFromString
public static InlineAnnotation createFromString(String storage)
Creates a new InlineAnnotation object from a storage string.- Parameters:
storage- the serialized representation of the object.- Returns:
- a new InlineAnnotation object.
-
clone
public InlineAnnotation clone()
Clones this annotation.- Specified by:
clonein interfaceIPersistentAnnotation- Overrides:
clonein classObject- Returns:
- A new InlineAnnotation object that is a copy of this one.
-
toString
public String toString()
Gets a storage string representation of the whole annotation that can be used for serialization.- Specified by:
toStringin interfaceIAnnotation- Overrides:
toStringin classObject- Returns:
- The storage string representation of this annotation.
-
fromString
public void fromString(String storage)
Initializes this annotation from a storage string originally obtained fromtoString().- Specified by:
fromStringin interfaceIPersistentAnnotation- Parameters:
storage- The storage string to use for the initialization.
-
getData
public String getData()
Gets the data for this annotation.- Returns:
- The data of this annotation.
-
setData
public void setData(String data)
Sets the data for this annotation.- Parameters:
data- The data to set.
-
-