public class TextPart extends Object implements IWithProperties, IWithAnnotations, Cloneable
| Modifier and Type | Field and Description |
|---|---|
protected Annotations |
annotations |
String |
id
Identifier of this segment.
|
String |
originalId
Original identifier of this segment in another format (xliff2 etc..).
|
protected LinkedHashMap<String,Property> |
properties |
TextFragment |
text
Text fragment of this part.
|
| Constructor and Description |
|---|
TextPart()
Creates an empty part.
|
TextPart(String text)
Creates a new TextPart with a given text string.
|
TextPart(String id,
TextFragment text)
Creates a new TextPart with a given
TextFragment. |
TextPart(TextFragment text)
Creates a new TextPart with a given
TextFragment. |
| Modifier and Type | Method and Description |
|---|---|
TextPart |
clone()
Clone of
TextPart |
void |
forceId(String id)
Forces the id to a specific value.
|
<A extends IAnnotation> |
getAnnotation(Class<A> annotationType)
Gets the annotation object for a given class for this resource.
|
Iterable<IAnnotation> |
getAnnotations()
Gets the iterable list of the annotations for this resource.
|
TextFragment |
getContent()
Gets the text fragment for this part.
|
String |
getId()
Gets the identifier for this textpart.
|
Property |
getProperty(String name)
Gets the resource-level property for a given name.
|
Set<String> |
getPropertyNames()
Gets the names of all the resource-level properties for this resource.
|
boolean |
hasProperty(String name)
Indicates if a resource-level property exists for a given name.
|
boolean |
isSegment()
Indicates if this part is a
Segment. |
void |
removeProperty(String name)
Removes a resource-level property of a given name.
|
void |
setAnnotation(IAnnotation annotation)
Sets an annotation object for this resource.
|
void |
setContent(TextFragment fragment)
Sets the
TextFragment for this part. |
Property |
setProperty(Property property)
Sets a resource-level property.
|
String |
toString() |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcopycopyprotected LinkedHashMap<String,Property> properties
protected Annotations annotations
public String id
public String originalId
public TextFragment text
public TextPart()
public TextPart(TextFragment text)
TextFragment.text - the TextFragment for this new part.public TextPart(String id, TextFragment text)
TextFragment.text - the TextFragment for this new part.public TextPart(String text)
text - the text for this new part.public String getId()
public void forceId(String id)
id - the new value of the textpart.public TextFragment getContent()
public void setContent(TextFragment fragment)
TextFragment for this part.fragment - the TextFragment to assign to this part. It must not
be null.public boolean isSegment()
Segment.Segment, false if it is not.public Iterable<IAnnotation> getAnnotations()
IWithAnnotationsgetAnnotations in interface IWithAnnotationspublic <A extends IAnnotation> A getAnnotation(Class<A> annotationType)
IWithAnnotationsgetAnnotation in interface IWithAnnotationsA - the type of the class.annotationType - the class of the annotation object to retrieve.public void setAnnotation(IAnnotation annotation)
IWithAnnotationssetAnnotation in interface IWithAnnotationsannotation - the annotation object to set.public Property getProperty(String name)
IWithPropertiesgetProperty in interface IWithPropertiesname - Name of the property to retrieve.public Property setProperty(Property property)
IWithPropertiessetProperty in interface IWithPropertiesproperty - The new property to set.public void removeProperty(String name)
IWithPropertiesremoveProperty in interface IWithPropertiesname - The name of the property to remove.public Set<String> getPropertyNames()
IWithPropertiesgetPropertyNames in interface IWithPropertiespublic boolean hasProperty(String name)
IWithPropertieshasProperty in interface IWithPropertiesname - The name of the resource-level property to query.Copyright © 2021. All rights reserved.