public class Convertible
extends groovy.lang.GroovyObjectSupport
Constructor and Description |
---|
Convertible(java.lang.Object text)
same as toString(text), i.e.
|
Convertible(java.lang.String text)
doesn't evaluate formulas since this would require a calculation rule or NodeModel.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Convertible convertible) |
int |
compareTo(java.lang.Object string) |
boolean |
equals(java.lang.Object obj)
note: if obj is a String the result is true if String.equals(text).
|
java.util.Calendar |
getCalendar()
returns a Calendar for the parsed text.
|
java.util.Date |
getDate()
returns a Date for the parsed text.
|
java.lang.Number |
getNum()
returns a Long or a Double, whatever fits best.
|
java.lang.Number |
getNum0()
"Safe" variant of getNum(): returns a Long or a Double if text is convertible to it or 0 otherwise
(even if text is null).
|
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() |
java.lang.Object |
getProperty(java.lang.String property)
pretend we are a String if we don't provide a property for ourselves.
|
java.lang.String |
getString() |
java.lang.String |
getText() |
Convertible |
getTo()
Allow statements like this:
node['attr_name'].to.num . |
java.net.URI |
getUri() |
int |
hashCode()
since equals handles Strings special we have to stick to that here too since
equal objects have to have the same hasCode.
|
java.lang.Object |
invokeMethod(java.lang.String name,
java.lang.Object args)
pretend we are a String if we don't provide a method for ourselves.
|
boolean |
isDate()
returns true if the text is convertible to date.
|
boolean |
isNum()
returns true if the text is convertible to number.
|
void |
setProperty(java.lang.String property,
java.lang.Object newValue) |
java.lang.String |
toString() |
static java.lang.String |
toString(java.lang.Object value)
has special conversions for
Date and Calendar are converted by
org.apache.commons.lang.time.DateFormatUtils.format(date, "yyyy-MM-dd'T'HH:mm:ss.SSSZ"), i.e.
|
public Convertible(java.lang.String text)
public Convertible(java.lang.Object text)
public java.lang.Number getNum() throws org.freeplane.plugin.script.proxy.ConversionException
Long.decode(String)
ConversionException
- if text is not a number.public java.lang.Number getNum0()
nothing
- - on any error (long) 0 is returned.public java.lang.String getString()
public java.lang.String getText()
public java.lang.String getPlain()
public java.util.Date getDate() throws org.freeplane.plugin.script.proxy.ConversionException
ConversionException
- if the text is not convertible to a date.public java.util.Calendar getCalendar() throws org.freeplane.plugin.script.proxy.ConversionException
ConversionException
- if the text is not convertible to a date.public java.net.URI getUri() throws org.freeplane.plugin.script.proxy.ConversionException
org.freeplane.plugin.script.proxy.ConversionException
public java.lang.Object getObject()
public Convertible getTo()
node['attr_name'].to.num
.public boolean isNum()
public boolean isDate()
public java.lang.Object getProperty(java.lang.String property)
getProperty
in interface groovy.lang.GroovyObject
getProperty
in class groovy.lang.GroovyObjectSupport
public java.lang.Object invokeMethod(java.lang.String name, java.lang.Object args)
invokeMethod
in interface groovy.lang.GroovyObject
invokeMethod
in class groovy.lang.GroovyObjectSupport
public static java.lang.String toString(java.lang.Object value)
public int compareTo(java.lang.Object string)
public int compareTo(Convertible convertible)
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public void setProperty(java.lang.String property, java.lang.Object newValue)
setProperty
in interface groovy.lang.GroovyObject
setProperty
in class groovy.lang.GroovyObjectSupport