Class CMARichText
- java.lang.Object
-
- com.contentful.java.cma.model.rich.CMARichNode
-
- com.contentful.java.cma.model.rich.CMARichText
-
public class CMARichText extends CMARichNode
A leaf element of the rich text node graph: Render a given text with the given markings.
-
-
Field Summary
-
Fields inherited from class com.contentful.java.cma.model.rich.CMARichNode
data
-
-
Constructor Summary
Constructors Constructor Description CMARichText(java.lang.CharSequence value, java.util.List<CMARichMark> marks)Create a value with the given marks.CMARichText(java.lang.String value)Create a text with the given marks.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CMARichTextaddMarks(CMARichMark... marks)Adds the given marks to this texts marks.java.util.List<CMARichMark>getMarks()java.lang.CharSequencegetValue()CMARichTextsetMarks(java.util.List<CMARichMark> marks)Updates the marks of this text.CMARichTextsetValue(java.lang.CharSequence value)Update the value of this text.-
Methods inherited from class com.contentful.java.cma.model.rich.CMARichNode
getNodeType
-
-
-
-
Constructor Detail
-
CMARichText
public CMARichText(@NonNull java.lang.CharSequence value, @NonNull java.util.List<CMARichMark> marks)Create a value with the given marks.- Parameters:
value- the value to be displayed.marks- the marks to be used if any.- Throws:
java.lang.NullPointerException- if one of the arguments is null.
-
CMARichText
public CMARichText(@NonNull java.lang.String value)Create a text with the given marks.- Parameters:
value- the text to be displayed.- Throws:
java.lang.NullPointerException- if value is null.
-
-
Method Detail
-
getValue
@NonNull public java.lang.CharSequence getValue()
- Returns:
- the value text of this node.
-
setValue
@NonNull public CMARichText setValue(@NonNull java.lang.CharSequence value)
Update the value of this text.- Parameters:
value- the new value of the text.- Returns:
- this instance for chaining.
-
getMarks
@NonNull public java.util.List<CMARichMark> getMarks()
- Returns:
- the currently setup marks of this text.
-
addMarks
@NonNull public CMARichText addMarks(@NonNull CMARichMark... marks)
Adds the given marks to this texts marks.- Parameters:
marks- defines which marks to be added.- Returns:
- this instance for chaining.
- Throws:
java.lang.NullPointerException- if marks is null.
-
setMarks
@NonNull public CMARichText setMarks(@NonNull java.util.List<CMARichMark> marks)
Updates the marks of this text.- Parameters:
marks- defines which marks to be used.- Returns:
- this instance for chaining.
- Throws:
java.lang.NullPointerException- if marks is null.
-
-