|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.clearsilver.jsilver.data.TypeConverter
public class TypeConverter
Static methods for converting stuff in a ClearSilver compatible way.
Method Summary | |
---|---|
static boolean |
asBoolean(Data data)
Helper method to safely convert an arbitrary data instance (including null) into a valid boolean representation. |
static boolean |
asBoolean(String value)
Parses and returns the given string as a boolean in a ClearSilver compatible way. |
static int |
asNumber(Data data)
Helper method to safely convert an arbitrary data instance (including null) into a valid integer representation. |
static int |
asNumber(String value)
Parses and returns the given string as an integer in a ClearSilver compatible way. |
static String |
asString(Data data)
Helper method to safely convert an arbitrary data instance (including null) into a valid (non-null) string representation. |
static boolean |
exists(Data data)
Determines if the given data node exists in a ClearSilver compatible way. |
static int |
parseNumber(String value)
Parses a non-null string in a ClearSilver compatible way. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static boolean exists(Data data)
public static String asString(Data data)
public static int parseNumber(String value) throws NumberFormatException
"123abc"
parses to 123
.
Additionally, ClearSilver doesn't do hex in HDF values, so "a.b=0x123"
will just
resolve to 0
.
In ClearSilver templates: Hex is supported, including negative values.
In JSilver: A string must be a complete, valid numeric value for parsing. This means "123abc"
is invalid and will default to 0
.
In JSilver: Positive hex values are supported for both HDF and templates but negative values
aren't. This means a template containing something like "" will parse
correctly but fail to render.
NumberFormatException
- is the string is badly formattedpublic static int asNumber(String value)
public static int asNumber(Data data)
public static boolean asBoolean(String value)
public static boolean asBoolean(Data data)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |