Package org.freeplane.api
Interface Convertible
- All Known Implementing Classes:
- Convertible
public interface Convertible
Utility wrapper class around a String that is used to convert node texts to different types.
 It's especially important for Formulas.
- 
Method SummaryModifier and TypeMethodDescriptionbooleanFor implicit conversion to boolean: true if the text is not empty.intintcompareTo(Convertible convertible) booleangetBool()parses the text (case insensitive) as boolean viaBoolean.parseBoolean(String).Converts to Calendar if possible.getDate()Converts to Date if possible.getNum()Convert to Number.getNum0()Safe variant ofgetNum(), throws nothing - on any error (long) 0 is returned.Uses the following priority ranking to determine the type of the text: null Long Double Date StringgetPlain()Removes HTML markup if necessary.getRaw()Returns original objectNo conversion.getText()No conversion.getUri()Converts to URI if possible.booleanisDate()Type check.booleanisNum()Type check.
- 
Method Details- 
getNumConvert to Number. All Java number literals are allowed as described byLong.decode(String)- Returns:
- a Long or a Double, whatever fits best.
- Throws:
- ConversionException- if text is not a number.
 
- 
getNum0Number getNum0()Safe variant ofgetNum(), throws nothing - on any error (long) 0 is returned.- Returns:
- a Long or a Double if text is convertible to it or 0 otherwise (even if text is null).
 
- 
getStringString getString()No conversion.- Returns:
- The original string.
 
- 
getTextString getText()No conversion.- Returns:
- The original string.
 
- 
getPlainString getPlain()Removes HTML markup if necessary.- Returns:
- The result of HtmlUtils.htmlToPlain(String)
 
- 
getDateConverts to Date if possible. The valid date patterns are "yyyy-MM-dd HH:dd:ss.SSSZ" with optional '-', ':'. ' ' may be replaced by 'T'.- Returns:
- a Date for the parsed text
- Throws:
- ConversionException- if the text is not convertible to a Date.
 
- 
getCalendarConverts to Calendar if possible. SeegetDate()for recognized patterns.- Returns:
- a Calendar for the parsed text.
- Throws:
- ConversionException- if the text is not convertible to a Date.
 
- 
getUriConverts to URI if possible.- Returns:
- a URI
- Throws:
- ConversionException- if the text is not convertible to a URI.
 
- 
getObjectObject getObject()Uses the following priority ranking to determine the type of the text:- null
- Long
- Double
- Date
- String
 - Returns:
- Object - the type that fits best.
 
- 
getRawObject getRaw()Returns original object- Returns:
- the original object
- Since:
- 1.7.4
 
- 
isNumboolean isNum()Type check.- Returns:
- true if the text is convertible to number.
 
- 
isDateboolean isDate()Type check.- Returns:
- true if the text is convertible to date.
 
- 
compareTo
- 
compareTo
- 
getBoolboolean getBool()parses the text (case insensitive) as boolean viaBoolean.parseBoolean(String).- Returns:
- boolean
 
- 
asBooleanboolean asBoolean()For implicit conversion to boolean: true if the text is not empty.- Returns:
- boolean
 
 
-