public class TextDescription
extends java.lang.Object
Ensure you specify correct kind (text format), otherwise the result of writing the documentation may have unexpected formatting.
Modifier and Type | Class and Description |
---|---|
static class |
TextDescription.TextKind
Kind of text formatting that helps to optimise writing text to various formats.
|
Modifier and Type | Field and Description |
---|---|
private static org.apache.log4j.Logger |
_logger |
static TextDescription.TextKind |
DEFAULT_KIND |
static java.lang.String |
DEFAULT_TEXT |
static TextDescription |
EMPTY_HTML |
static TextDescription |
EMPTY_TXT |
TextDescription.TextKind |
kind |
java.lang.String |
text |
Constructor and Description |
---|
TextDescription()
Creates an instance with defaults.
|
TextDescription(java.lang.String text)
Creates an instance with the content in
text trimmed of whitespace, and
DEFAULT_KIND . |
TextDescription(java.lang.String text,
TextDescription.TextKind kind)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
TextDescription |
appendParagraph(java.lang.String paragraph)
Returns new instance with the
paragraph appended to the original text as a
paragraph (for HTML, it will enclose paragraph into paragraph tags, and for
text, it will first append a new line character then paragraph ); or unmodified
instance if paragraph is null or empty. |
boolean |
isEmpty() |
TextDescription |
prepend(java.lang.String prefix)
Returns new instance with the
prefix prepended to the original text; or
unmodified instance if prefix is null or empty. |
TextDescription |
prepend(java.lang.String prefix,
java.lang.Object o)
Returns new instance with the
prefix prepended to the original text; or
unmodified instance if prefix is null or empty. |
java.lang.String |
toString() |
private static final org.apache.log4j.Logger _logger
public static final TextDescription.TextKind DEFAULT_KIND
public static final java.lang.String DEFAULT_TEXT
public static final TextDescription EMPTY_TXT
public static final TextDescription EMPTY_HTML
public final TextDescription.TextKind kind
public final java.lang.String text
public TextDescription()
public TextDescription(java.lang.String text)
text
trimmed of whitespace, and
DEFAULT_KIND
.text
- public TextDescription(java.lang.String text, TextDescription.TextKind kind)
text
- text; will be trimmed of whitespace.kind
- kind of text; if text
contains only whitespace and the argument is
TextDescription.TextKind.textWithNL
, the kind stored will be TextDescription.TextKind.textNoNL
. It
is the responsibility of the caller to properly set the kind of text according to
the content in text
, otherwise any writing may produce undesired
results.public TextDescription prepend(java.lang.String prefix)
prefix
prepended to the original text; or
unmodified instance if prefix
is null or empty.prefix
- can be null/empty, but should not contain any markup or new line character
(otherwise, result is undefined).public TextDescription prepend(java.lang.String prefix, java.lang.Object o)
prefix
prepended to the original text; or
unmodified instance if prefix
is null or empty.prefix
- can be null/empty, but should not contain any markup or new line character
(otherwise, result is undefined).o
- if not null, may be used for logging warning condition.public TextDescription appendParagraph(java.lang.String paragraph)
paragraph
appended to the original text as a
paragraph (for HTML, it will enclose paragraph
into paragraph tags, and for
text, it will first append a new line character then paragraph
); or unmodified
instance if paragraph
is null or empty.paragraph
- can be null/empty, can contain markup or new line character.public boolean isEmpty()
public java.lang.String toString()
toString
in class java.lang.Object
Copyright 2009-2015 Tatjana (Tanja) Kostic