public class TextPart extends Object implements IResource
| Modifier and Type | Field and Description |
|---|---|
protected Annotations |
annotations |
String |
id
Identifier of this segment.
|
String |
originalId
Some formats already have id's like xliff2
|
protected Map<String,Property> |
properties |
TextFragment |
text
Text fragment of this part.
|
WhitespaceStrategy |
whitespaceStrategy |
COPY_ALL, COPY_CONTENT, COPY_PROPERTIES, COPY_SEGMENTATION, COPY_SEGMENTED_CONTENT, CREATE_EMPTY| 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 |
Annotations |
getAnnotations() |
TextFragment |
getContent()
Gets the text fragment for this part.
|
String |
getId()
Gets the identifier for this textpart.
|
String |
getOriginalId() |
Map<String,Property> |
getProperties() |
WhitespaceStrategy |
getWhitespaceStrategy() |
boolean |
isSegment()
Indicates if this part is a
Segment. |
boolean |
preserveWhitespaces()
WARNING: The parent
ITextUnit must be used in the case the
whitespaceSrategy is INHERIT. We return false in the case of INHERIT
because we have not specially set the whitespace handling TextPart and so it
is the responsibility of the user to check the parent for the "real" value. |
void |
setContent(TextFragment fragment)
Sets the
TextFragment for this part. |
void |
setId(String id)
Sets the identifier of this resource.
|
void |
setOriginalId(String originalId) |
void |
setPreserveWhitespaces(boolean preserveWS)
Only use this method if you are overriding the parent
ITextUnit whitespace handling. |
void |
setWhitespaceStrategy(WhitespaceStrategy whitespaceStrategy) |
String |
toString() |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcopy, getProperty, getPropertyNames, hasProperty, propertyIterator, removeProperty, setPropertyannotationIterator, clear, copy, getAnnotation, getAnnotationsTypesAsSet, hasAnnotation, hasAnnotations, remove, setAnnotationgetSkeleton, setSkeletonpublic String id
public String originalId
public TextFragment text
public WhitespaceStrategy whitespaceStrategy
protected Annotations annotations
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 setId(String id)
IResourcesetId in interface IResourceid - the new identifier value.IResource.getId()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 WhitespaceStrategy getWhitespaceStrategy()
public void setWhitespaceStrategy(WhitespaceStrategy whitespaceStrategy)
public boolean isSegment()
Segment.Segment, false if it is not.public Map<String,Property> getProperties()
getProperties in interface IWithPropertiesMap of properties for the implementer of interfacepublic Annotations getAnnotations()
getAnnotations in interface IWithAnnotationsAnnotations for the implementer of interfacepublic boolean preserveWhitespaces()
ITextUnit must be used in the case the
whitespaceSrategy is INHERIT. We return false in the case of INHERIT
because we have not specially set the whitespace handling TextPart and so it
is the responsibility of the user to check the parent for the "real" value.public void setPreserveWhitespaces(boolean preserveWS)
ITextUnit whitespace handling.preserveWS - true to preserve whitespace, otherwise normalizepublic String getOriginalId()
public void setOriginalId(String originalId)
Copyright © 2021. All rights reserved.