Class InlineElement
- Since:
 - 0.0.11
 - Author:
 - Thomas Kwashnak
 
- 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionprotected <T> TcheckType(T object) Checks the type of a passed object.booleanWhether a new line should be added after inserting the element into a document.booleanWhether the element requires at least one\nbefore printing itself in a documentMethods inherited from class org.tealeaf.javamarkdown.MarkdownElement
asString, asString, toAppendable, toString, toWriter 
- 
Constructor Details
- 
InlineElement
public InlineElement() 
 - 
 - 
Method Details
- 
checkType
protected <T> T checkType(T object) Checks the type of a passed object. This method is specific to each element and throws an
IllegalContentsExceptionif the passed object cannot be put in as a content of that element. This prevents instances such as nested tables, where a table is put inside another table. If such feature is necessary, using theMarkdownElement.toString()of any markdown element will force it to be accepted in any spotThrows
IllegalContentsExceptionif object is an instance of theStructureclassThrows
IllegalContentsExceptionif object is instance of the same class (such as anItalicwithin anItalic)- Specified by:
 checkTypein classMarkdownElement- Type Parameters:
 T- The type of the item- Parameters:
 object- The item to check it's class- Returns:
 - That item if it is not an instance of any illegal types
 - Since:
 - 0.0.11
 
 - 
requiresNewlineAfter
public boolean requiresNewlineAfter()Whether a new line should be added after inserting the element into a document. This is particularly useful for structures that need to have a newline after it gets rendered
For example, if some text was printed immediately after a list, it would render as:
- item 1 - item 2 - item 3some textThus, by requiring a new line after the element is rendered, we get the following output instead:
- item 1 - item 2 - item 3 some textThis method is natively used in
MarkdownWriter.appendMarkdownElement(MarkdownElement)to handle adding newlines when necessary- Specified by:
 requiresNewlineAfterin classMarkdownElement- Returns:
 - false
 - Since:
 - 0.0.19
 
 - 
requiresNewlineBefore
public boolean requiresNewlineBefore()Whether the element requires at least one
\nbefore printing itself in a documentIn instances such as in-line elements (like
Bold), this would returnfalsebecause bolds can be inserted directly in-line. However, in instances such asNumberedList, it would be required that there is a new line to prevent the followingSome sentence - item 1 - item 2 - item 3and instead print the following
Some sentence - item 1 - item 2This method is natively used in
MarkdownWriter.appendMarkdownElement(MarkdownElement)to handle adding newlines when necessary- Specified by:
 requiresNewlineBeforein classMarkdownElement- Returns:
 - false
 - Since:
 - 0.0.19
 
 
 -