public interface Convertible
Modifier and Type | Method and Description |
---|---|
boolean |
asBoolean()
For implicit conversion to boolean: true if the text is not empty.
|
int |
compareTo(Convertible convertible) |
int |
compareTo(java.lang.Object string) |
boolean |
getBool()
parses the text (case insensitive) as boolean via
Boolean.parseBoolean(String) . |
java.util.Calendar |
getCalendar()
Converts to Calendar if possible.
|
java.util.Date |
getDate()
Converts to Date if possible.
|
java.lang.Number |
getNum()
Convert to Number.
|
java.lang.Number |
getNum0()
Safe variant of
getNum() , throws nothing - on any error (long) 0 is returned. |
java.lang.Object |
getObject()
Uses the following priority ranking to determine the type of the text:
null
Long
Double
Date
String
|
java.lang.String |
getPlain()
Removes HTML markup if necessary.
|
java.lang.Object |
getRaw()
Returns original object
|
java.lang.String |
getString()
No conversion.
|
java.lang.String |
getText()
No conversion.
|
java.net.URI |
getUri()
Converts to URI if possible.
|
boolean |
isDate()
Type check.
|
boolean |
isNum()
Type check.
|
java.lang.Number getNum() throws ConversionException
Long.decode(String)
ConversionException
- if text is not a number.java.lang.Number getNum0()
getNum()
, throws nothing - on any error (long) 0 is returned.java.lang.String getString()
java.lang.String getText()
java.lang.String getPlain()
HtmlUtils.htmlToPlain(String)
java.util.Date getDate() throws ConversionException
ConversionException
- if the text is not convertible to a Date.java.util.Calendar getCalendar() throws ConversionException
getDate()
for recognized patterns.ConversionException
- if the text is not convertible to a Date.java.net.URI getUri() throws ConversionException
ConversionException
- if the text is not convertible to a URI.java.lang.Object getObject()
java.lang.Object getRaw()
boolean isNum()
boolean isDate()
int compareTo(java.lang.Object string)
int compareTo(Convertible convertible)
boolean getBool()
Boolean.parseBoolean(String)
.boolean asBoolean()