Package com.jtelegram.api.util
Class TextBuilder
- java.lang.Object
-
- com.jtelegram.api.util.TextBuilder
-
public class TextBuilder extends java.lang.Object
This class allows developers to format their text in a simple manner with automatic basic escaping; creating a more elegant solution without weird markdown escaping or manually writing HTML-formatted text. All public methods will escape their input (except TextBuilder#html(String)) and format accordingly. Keep in mind that while most places should accept an instance of this builder as valid input, using TextBuilder#toHtml() requires that you specify the parse mode to HTML in the request you're sending.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
TextBuilder()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description TextBuilder
bold(java.lang.String text)
TextBuilder
code(java.lang.String text)
static TextBuilder
create()
TextBuilder
escaped(java.lang.String text)
TextBuilder
html(java.lang.String html)
TextBuilder
italics(java.lang.String text)
TextBuilder
link(java.lang.String text, java.lang.String link)
TextBuilder
newLine()
TextBuilder
newLines(int n)
TextBuilder
nextLine()
TextBuilder
plain(java.lang.String text)
TextBuilder
preformatted(java.lang.String text)
TextBuilder
space()
java.lang.String
toHtml()
java.lang.String
toString()
-
-
-
Method Detail
-
create
public static TextBuilder create()
-
plain
public TextBuilder plain(java.lang.String text)
-
escaped
public TextBuilder escaped(java.lang.String text)
-
html
public TextBuilder html(java.lang.String html)
-
bold
public TextBuilder bold(java.lang.String text)
-
italics
public TextBuilder italics(java.lang.String text)
-
link
public TextBuilder link(java.lang.String text, java.lang.String link)
-
code
public TextBuilder code(java.lang.String text)
-
preformatted
public TextBuilder preformatted(java.lang.String text)
-
space
public TextBuilder space()
-
newLine
public TextBuilder newLine()
-
newLines
public TextBuilder newLines(int n)
-
nextLine
public TextBuilder nextLine()
-
toHtml
public java.lang.String toHtml()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-