Package com.atlassian.adf.model.node
Class Rule
- java.lang.Object
-
- com.atlassian.adf.model.node.AbstractNode<Rule>
-
- com.atlassian.adf.model.node.Rule
-
- All Implemented Interfaces:
Element,Node,DocContent,LayoutColumnContent,NonNestableBlockContent,TableCellContent
@Immutable public class Rule extends AbstractNode<Rule> implements DocContent, LayoutColumnContent, NonNestableBlockContent, TableCellContent
Representing a divider, this is equivalent to an HTML<hr/>tag.Example
Java
doc(p("Hello"),hr(),p("World"), );ADF
{ "version": 1, "type": "doc", "content": [ { "type": "paragraph", "content": [ { "type": "text", "text": "Hello" } ] }, { "type": "rule" }, { "type": "paragraph", "content": [ { "type": "text", "text": "World" } ] }, ] }Result
Hello
World
- See Also:
- Node - rule
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.atlassian.adf.model.node.AbstractNode
AbstractNode.ToStringHelper
-
-
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.Rulecopy()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".static Rulehr()static Rulerule()Map<String,?>toMap()Transforms this element to a map ofStringvalues to various basic object types suitable for direct rendering as JSON content.voidvalidate()Verifies that the node is well-formed (including the state of any descendents that it has).-
Methods inherited from class com.atlassian.adf.model.node.AbstractNode
appendNodeFields, doubleEq, doubleHash, equals, hashCode, isSupported, mapWithType, nodeEquals, nodeHashCode, 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.Element
isSupported
-
Methods inherited from interface com.atlassian.adf.model.node.Node
toPlainText
-
-
-
-
Method Detail
-
rule
public static Rule rule()
-
hr
public static Rule hr()
-
copy
public Rule 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.
-
elementType
public String elementType()
Description copied from interface:ElementThetypevalue that identifies this element, such as"paragraph"or"strong".- Specified by:
elementTypein interfaceElement
-
validate
public void validate()
Description copied from interface:ElementVerifies that the node is well-formed (including the state of any descendents that it has).
-
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 classAbstractNode<Rule>- Parameters:
sb- where to write the result
-
-