Package com.atlassian.adf.model.node
Class Blockquote
- java.lang.Object
-
- com.atlassian.adf.model.node.AbstractNode<C>
-
- com.atlassian.adf.model.node.AbstractContentNode<Blockquote,Paragraph>
-
- com.atlassian.adf.model.node.Blockquote
-
- All Implemented Interfaces:
Element,Node,ContentNode<Blockquote,Paragraph>,DocContent,LayoutColumnContent,NonNestableBlockContent,TableCellContent
public class Blockquote extends AbstractContentNode<Blockquote,Paragraph> implements DocContent, LayoutColumnContent, NonNestableBlockContent, TableCellContent
TheBlockquotenode is a container for quotes. At least oneParagraphmust be provided as the block'scontent.Example
Java
bq(p("Hello world"),p("\u2014 Atlassian Document Format") );ADF
{ "type": "blockquote", "content": [ { "type": "paragraph", "content": [ { "type": "text", "text": "Hello world" } ] }, { "type": "paragraph", "content": [ { "type": "text", "text": "— Atlassian Document Format" } ] } ] }Result
Hello, world
— Atlassian Document Format
- See Also:
- Node - blockquote
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.atlassian.adf.model.node.AbstractNode
AbstractNode.ToStringHelper
-
-
Field Summary
-
Fields inherited from class com.atlassian.adf.model.node.AbstractContentNode
content
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidappendPlainText(StringBuilder sb)Renders this node as plain-text suitable for viewing by end users.static Blockquoteblockquote()static Blockquoteblockquote(Paragraph content)static Blockquoteblockquote(Paragraph... content)static Blockquoteblockquote(Iterable<? extends Paragraph> content)static Blockquoteblockquote(String content)static Blockquoteblockquote(String... content)static Blockquoteblockquote(Stream<? extends Paragraph> content)static Blockquotebq()Create an emptyBlockquotenode.static Blockquotebq(Paragraph content)Create aBlockquotenode containing a single paragraph as its content.static Blockquotebq(Paragraph... content)Create aBlockquotenode containing the given paragraph as its content.static Blockquotebq(Iterable<? extends Paragraph> content)Create aBlockquotenode containing the given paragraph as its content.static Blockquotebq(String content)Create aBlockquotenode containing a single paragraph with the given text as its content.static Blockquotebq(String... content)Create aBlockquotenode containing a single paragraph with the given text as its content.static Blockquotebq(Stream<? extends Paragraph> content)Create aBlockquotenode containing the given paragraph as its content.Class<Paragraph>contentClass()ReturnsClass<N>, the class representing the type of items held by this node.protected voidcontentNodeValidate()Blockquotecopy()Returns a deep copy of this element, including copies of any nodes or marks that it contains.StringelementType()Thetypevalue that identifies this element, such as"paragraph"or"strong".Map<String,?>toMap()Transforms this element to a map ofStringvalues to various basic object types suitable for direct rendering as JSON content.protected voidvalidateContentNodeForAppend(Paragraph node)Called on each content node before it is added to validate that the node can be accepted.-
Methods inherited from class com.atlassian.adf.model.node.AbstractContentNode
addContent, addContentIfPresent, allNodes, appendContentNodeFields, appendNodeFields, appendPlainTextContentJoinedWith, appendPlainTextInlineContent, clear, content, content, content, content, content, contentFieldMaps, contentNodeEquals, contentNodeHashCode, isEmpty, nodeEquals, nodeHashCode, parseContentItem, parseContentItems, parseOptionalContent, parseRequiredContent, parseRequiredContentAllowEmpty, removeIf, replaceContent, requireNotEmpty, transformContent, transformDescendants, trim, validate, validateContentItems
-
Methods inherited from class com.atlassian.adf.model.node.AbstractNode
doubleEq, doubleHash, equals, hashCode, isSupported, mapWithType, numberEq, numberHash, self, toPlainText, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.atlassian.adf.model.node.type.ContentNode
allNodesOfType, allNodesOfTypeAsList
-
Methods inherited from interface com.atlassian.adf.model.Element
isSupported, validate
-
Methods inherited from interface com.atlassian.adf.model.node.Node
toPlainText
-
-
-
-
Method Detail
-
contentClass
public Class<Paragraph> contentClass()
Description copied from interface:ContentNodeReturnsClass<N>, the class representing the type of items held by this node.- Specified by:
contentClassin interfaceContentNode<Blockquote,Paragraph>
-
bq
public static Blockquote bq()
Create an emptyBlockquotenode. At least oneParagraphmust be provided as the block'scontentto make it valid.- Returns:
- a new, empty
Blockquote
-
bq
public static Blockquote bq(String content)
Create aBlockquotenode containing a single paragraph with the given text as its content.- Parameters:
content- the string to use as the content of the block quote. As a convenience, the provided string is wrapped first as aTextnode and then as aParagraphbefore it is set as the content. It cannot be an empty string.- Returns:
- a new
Blockquotecontaining the provided text as its content
-
bq
public static Blockquote bq(String... content)
Create aBlockquotenode containing a single paragraph with the given text as its content. As a convenience, each element ofcontentis wrapped first as aTextnode and then as aParagraphbefore it is set as the content for thisBlockquote.At least one
Paragraphmust be provided as the block'scontentto make it valid.- Parameters:
content- the strings to use as the content of the block quote. As a convenience, each provided string is wrapped first as aTextnode and then as aParagraphbefore it is set as the content, so each element will form its own paragraph. None of them may be an empty string.- Returns:
- a new
Blockquotecontaining the provided text as its content
-
bq
public static Blockquote bq(Paragraph content)
Create aBlockquotenode containing a single paragraph as its content.- Parameters:
content- the paragraph to use as the content of the block quote.- Returns:
- a new
Blockquotecontaining the provided paragraph as its content
-
bq
public static Blockquote bq(Paragraph... content)
Create aBlockquotenode containing the given paragraph as its content. At least oneParagraphmust be provided as the block'scontentto make it valid.- Parameters:
content- the paragraphs to use as the content of the block quote.- Returns:
- a new
Blockquotecontaining the provided paragraph as its content
-
bq
public static Blockquote bq(Iterable<? extends Paragraph> content)
Create aBlockquotenode containing the given paragraph as its content. At least oneParagraphmust be provided as the block'scontentto make it valid.- Parameters:
content- the paragraphs to use as the content of the block quote. The iterable will be iterated at most once and immediately.- Returns:
- a new
Blockquotecontaining the provided paragraph as its content
-
bq
public static Blockquote bq(Stream<? extends Paragraph> content)
Create aBlockquotenode containing the given paragraph as its content. At least oneParagraphmust be provided as the block'scontentto make it valid.- Parameters:
content- the paragraphs to use as the content of the block quote. The stream will be terminated and consumed immediately.- Returns:
- a new
Blockquotecontaining the provided paragraph as its content
-
blockquote
public static Blockquote blockquote()
- See Also:
bq()
-
blockquote
public static Blockquote blockquote(String content)
- See Also:
bq(String)
-
blockquote
public static Blockquote blockquote(String... content)
- See Also:
bq(String[])
-
blockquote
public static Blockquote blockquote(Paragraph content)
- See Also:
bq(Paragraph)
-
blockquote
public static Blockquote blockquote(Paragraph... content)
- See Also:
bq(Paragraph[])
-
blockquote
public static Blockquote blockquote(Iterable<? extends Paragraph> content)
- See Also:
bq(Iterable)
-
blockquote
public static Blockquote blockquote(Stream<? extends Paragraph> content)
- See Also:
bq(Stream)
-
copy
public Blockquote copy()
Description copied from interface:ElementReturns a deep copy of this element, including copies of any nodes or marks that it contains. The copy will not necessarily be in exactly the same state as the original in some cases. For example, atextnode that is used inside acodeBlockwill have the ability to use marks on it disabled, but a copy made of the text node using this method will not similarly disallow marks unless it is also added to a content node with those same restrictions.Implementations notes:
- Implementations should narrow the return type.
- Implementations should
return thisif the element is immutable. The@Immutableannotation should be used on the class to offer additional confirmation of this intent. - Implementations should
return parse(toMap())if they have state. - While there may be cases where it is worthwhile to do something more efficient than
the conversion to a map and back, this is discouraged because it would add yet another
fragile piece of code that breaks when new data is added to the node. The
parseandtoMapmethods already have to be updated in these circumstances, so it makes sense to take advantage of that.
- Specified by:
copyin interfaceContentNode<Blockquote,Paragraph>- Specified by:
copyin interfaceElement- Specified by:
copyin interfaceNode- Returns:
- a copy of this element, or
thisif the element is immutable anyway
-
elementType
public String elementType()
Description copied from interface:ElementThetypevalue that identifies this element, such as"paragraph"or"strong".- Specified by:
elementTypein interfaceElement
-
contentNodeValidate
protected void contentNodeValidate()
- Overrides:
contentNodeValidatein classAbstractContentNode<Blockquote,Paragraph>
-
validateContentNodeForAppend
protected void validateContentNodeForAppend(Paragraph node)
Description copied from class:AbstractContentNodeCalled on each content node before it is added to validate that the node can be accepted.- Overrides:
validateContentNodeForAppendin classAbstractContentNode<Blockquote,Paragraph>- Parameters:
node- the node that is about to be added
-
toMap
public Map<String,?> toMap()
Description copied from interface:ElementTransforms this element to a map ofStringvalues to various basic object types suitable for direct rendering as JSON content.
-
appendPlainText
public void appendPlainText(StringBuilder sb)
Description copied from interface:NodeRenders this node as plain-text suitable for viewing by end users. This is equivalent to callingNode.toPlainText()and appending the result to the given buffer, except that it may be slightly more efficient, since it will write directly to the existing buffer instead of using a temporary buffer and having to make a copy of the result.- Specified by:
appendPlainTextin interfaceNode- Overrides:
appendPlainTextin classAbstractContentNode<Blockquote,Paragraph>- Parameters:
sb- where to write the result
-
-