|
Project Wonder 5.0 | |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecter.extensions.foundation.ERXValueUtilities
public class ERXValueUtilities
ERXValueUtilities has useful conversion methods for
reading and transforming boolean
,
int
and float
values.
Unless otherwise stated, when an empty string
(or one containing only whitespace) is given, then
the string is assumed to be null. This is because
D2W is not able to give back null values anymore.
Constructor Summary | |
---|---|
ERXValueUtilities()
|
Method Summary | ||
---|---|---|
static com.webobjects.foundation.NSArray |
arrayValue(java.lang.Object obj)
Basic utility method for reading NSArray values which works also with Strings. |
|
static com.webobjects.foundation.NSArray |
arrayValueWithDefault(java.lang.Object obj,
com.webobjects.foundation.NSArray def)
Basic utility method for reading NSArray values which also
works with serialized NSArrays and comma separated items. |
|
static java.math.BigDecimal |
bigDecimalValue(java.lang.Object obj)
Basic utility method for reading BigDecimal values which works also with Strings. |
|
static java.math.BigDecimal |
bigDecimalValueWithDefault(java.lang.Object obj,
java.math.BigDecimal def)
Basic utility method for reading BigDecimal values. |
|
static boolean |
booleanValue(java.lang.Object obj)
Basic utility method for determining if an object represents either a true or false value. |
|
static boolean |
booleanValueForBindingOnComponentWithDefault(java.lang.String binding,
com.webobjects.appserver.WOComponent component,
boolean def)
Deprecated. use ERXComponentUtilities.booleanValueForBinding(component, binding, def) |
|
static boolean |
booleanValueWithDefault(java.lang.Object obj,
boolean def)
Basic utility method for determining if an object represents either a true or false value. |
|
static java.lang.Boolean |
BooleanValueWithDefault(java.lang.Object obj,
java.lang.Boolean def)
Basic utility method for determining if an object represents either a true or false value. |
|
static int |
compare(int int1,
int int2)
Returns the comparison value between int1 and int2 (using Comparator rules) |
|
static com.webobjects.foundation.NSData |
dataValue(java.lang.Object obj)
Basic utility method for reading NSData values which works also with Strings. |
|
static com.webobjects.foundation.NSData |
dataValueWithDefault(java.lang.Object obj,
com.webobjects.foundation.NSData def)
Basic utility method for reading NSData values which also
works with serialized NSData. |
|
static com.webobjects.foundation.NSDictionary |
dictionaryValue(java.lang.Object obj)
Basic utility method for reading NSDictionary values which works also with Strings. |
|
static com.webobjects.foundation.NSDictionary |
dictionaryValueWithDefault(java.lang.Object obj,
com.webobjects.foundation.NSDictionary def)
Basic utility method for reading NSDictionary values which
also works with serialized NSDictionarys. |
|
static double |
doubleValue(java.lang.Object obj)
Basic utility method for reading double values. |
|
static double |
doubleValueWithDefault(java.lang.Object obj,
double def)
Basic utility method for reading double values. |
|
static java.lang.Double |
DoubleValueWithDefault(java.lang.Object obj,
java.lang.Double def)
Basic utility method for reading Double values. |
|
static
|
enumValue(java.lang.Object obj,
java.lang.Class<T> enumType)
Basic utility method for reading Enum values. |
|
static
|
enumValueWithDefault(java.lang.Object obj,
java.lang.Class<T> enumType,
T def)
Basic utility method for reading Enum values. |
|
static
|
enumValueWithRequiredDefault(java.lang.Object obj,
T def)
Basic utility method for reading Enum values. |
|
static float |
floatValue(java.lang.Object obj)
Basic utility method for reading float values. |
|
static float |
floatValueWithDefault(java.lang.Object obj,
float def)
Basic utility method for reading float values. |
|
static java.lang.Float |
FloatValueWithDefault(java.lang.Object obj,
java.lang.Float def)
Basic utility method for reading Float values. |
|
static java.lang.Integer |
IntegerValueWithDefault(java.lang.Object obj,
java.lang.Integer def)
Basic utility method for reading Integer values. |
|
static int |
intValue(java.lang.Object obj)
Basic utility method for reading int values. |
|
static int |
intValueWithDefault(java.lang.Object obj,
int def)
Basic utility method for reading int values. |
|
static boolean |
isNull(java.lang.Object obj)
Returns whether or not the given object is null or NSKVC.Null. |
|
static long |
longValue(java.lang.Object obj)
Basic utility method for reading long values. |
|
static long |
longValueWithDefault(java.lang.Object obj,
long def)
Basic utility method for reading long values. |
|
static java.lang.Long |
LongValueWithDefault(java.lang.Object obj,
java.lang.Long def)
Basic utility method for reading Long values. |
|
static com.webobjects.foundation.NSSet |
setValue(java.lang.Object obj)
Basic utility method for reading NSSet values which works also with Strings. |
|
static com.webobjects.foundation.NSSet |
setValueWithDefault(java.lang.Object obj,
com.webobjects.foundation.NSSet def)
Basic utility method for reading NSSet values which also
works with serialized NSSets and comma separated items. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ERXValueUtilities()
Method Detail |
---|
public static boolean isNull(java.lang.Object obj)
obj
- the object to check
public static boolean booleanValueForBindingOnComponentWithDefault(java.lang.String binding, com.webobjects.appserver.WOComponent component, boolean def)
binding
- the binding to parsecomponent
- the component to evaluate the binding ondef
- the default value if the binding value is null
public static boolean booleanValue(java.lang.Object obj)
0
, Strings are false if they equal (case insensitive) 'no',
'false' or parse to 0.
obj
- object to be evaluated
public static boolean booleanValueWithDefault(java.lang.Object obj, boolean def)
String
, or a Number
. Numbers are
false if they equal 0
, Strings are false if they equal (case
insensitive) 'no', 'false' or parse to 0. The default value is used if
the object is null.
obj
- object to be evaluateddef
- default value if object is null
public static java.lang.Boolean BooleanValueWithDefault(java.lang.Object obj, java.lang.Boolean def)
String
, or a Number
. Numbers are
false if they equal 0
, Strings are false if they equal (case
insensitive) 'no', 'false' or parse to 0. The default value is used if
the object is null.
obj
- object to be evaluateddef
- default value if object is null
public static int intValue(java.lang.Object obj)
intValueWithDefault(Object, int)
with a default of
0
.
obj
- object to be evaluated
public static int intValueWithDefault(java.lang.Object obj, int def)
int
values. The current
implementation tests if the object is an instance of a String, Number and
Boolean. Booleans are 1 if they equal true
. The default
value is used if the object is null or the boolean value is false.
obj
- object to be evaluateddef
- default value if object is null
public static java.lang.Integer IntegerValueWithDefault(java.lang.Object obj, java.lang.Integer def)
Integer
values. The current
implementation tests if the object is an instance of a String, Number and
Boolean. Booleans are 1 if they equal true
. The default
value is used if the object is null or the boolean value is false.
obj
- object to be evaluateddef
- default value if object is null
public static float floatValue(java.lang.Object obj)
floatValueWithDefault(Object, float)
with a default of
0
.
obj
- object to be evaluated
public static float floatValueWithDefault(java.lang.Object obj, float def)
float
values. The current
implementation tests if the object is an instance of a String, Number and
Boolean. Booleans are 1 if they equal true
. The default
value is used if the object is null or the boolean value is false.
obj
- object to be evaluateddef
- default value if object is null
public static java.lang.Float FloatValueWithDefault(java.lang.Object obj, java.lang.Float def)
Float
values. The current
implementation tests if the object is an instance of a String, Number and
Boolean. Booleans are 1 if they equal true
. The default
value is used if the object is null or the boolean value is false.
obj
- object to be evaluateddef
- default value if object is null
public static double doubleValue(java.lang.Object obj)
doubleValueWithDefault(Object, double)
with
a default of 0
.
obj
- object to be evaluated
public static double doubleValueWithDefault(java.lang.Object obj, double def)
double
values. The current
implementation tests if the object is an instance of a String, Number and
Boolean. Booleans are 1 if they equal true
. The default
value is used if the object is null or the boolean value is false.
obj
- object to be evaluateddef
- default value if object is null
public static java.lang.Double DoubleValueWithDefault(java.lang.Object obj, java.lang.Double def)
Double
values. The current
implementation tests if the object is an instance of a String, Number and
Boolean. Booleans are 1 if they equal true
. The default
value is used if the object is null or the boolean value is false.
obj
- object to be evaluateddef
- default value if object is null
public static long longValue(java.lang.Object obj)
longValueWithDefault(Object, long)
with a default of
0
.
obj
- object to be evaluated
public static long longValueWithDefault(java.lang.Object obj, long def)
long
values. The current
implementation tests if the object is an instance of a String, Number and
Boolean. Booleans are 1 if they equal true
. The default
value is used if the object is null or the boolean value is false.
obj
- object to be evaluateddef
- default value if object is null
public static java.lang.Long LongValueWithDefault(java.lang.Object obj, java.lang.Long def)
Long
values. The current
implementation tests if the object is an instance of a String, Number and
Boolean. Booleans are 1 if they equal true
. The default
value is used if the object is null or the boolean value is false.
obj
- object to be evaluateddef
- default value if object is null
public static com.webobjects.foundation.NSArray arrayValue(java.lang.Object obj)
arrayValueWithDefault(Object, NSArray)
with a default of
null
.
obj
- object to be evaluated
public static com.webobjects.foundation.NSArray arrayValueWithDefault(java.lang.Object obj, com.webobjects.foundation.NSArray def)
NSArray
values which also
works with serialized NSArrays and comma separated items. The default
value is used if the object is null.
obj
- object to be evaluateddef
- default value if object is null
public static com.webobjects.foundation.NSSet setValue(java.lang.Object obj)
setValueWithDefault(Object, NSSet)
with a default of
null
.
obj
- object to be evaluated
public static com.webobjects.foundation.NSSet setValueWithDefault(java.lang.Object obj, com.webobjects.foundation.NSSet def)
NSSet
values which also
works with serialized NSSets and comma separated items. The default value
is used if the object is null.
obj
- object to be evaluateddef
- default value if object is null
public static com.webobjects.foundation.NSDictionary dictionaryValue(java.lang.Object obj)
dictionaryValueWithDefault(Object, NSDictionary)
with a default
of null
.
obj
- object to be evaluated
public static com.webobjects.foundation.NSDictionary dictionaryValueWithDefault(java.lang.Object obj, com.webobjects.foundation.NSDictionary def)
NSDictionary
values which
also works with serialized NSDictionarys. The default value is used if
the object is null.
obj
- object to be evaluateddef
- default value if object is null
public static com.webobjects.foundation.NSData dataValue(java.lang.Object obj)
dataValueWithDefault(Object, NSData)
with a default of
null
.
obj
- object to be evaluated
public static com.webobjects.foundation.NSData dataValueWithDefault(java.lang.Object obj, com.webobjects.foundation.NSData def)
NSData
values which also
works with serialized NSData. The default value is used if the object is
null.
obj
- object to be evaluateddef
- default value if object is null
public static java.math.BigDecimal bigDecimalValue(java.lang.Object obj)
bigDecimalValueWithDefault(Object, BigDecimal)
with a default of
null
.
obj
- object to be evaluated
public static java.math.BigDecimal bigDecimalValueWithDefault(java.lang.Object obj, java.math.BigDecimal def)
BigDecimal
values. The
default value is used if the object is null.
obj
- object to be evaluateddef
- default value if object is null
public static int compare(int int1, int int2)
int1
- value 1int2
- value 2
public static <T extends java.lang.Enum<T>> T enumValue(java.lang.Object obj, java.lang.Class<T> enumType)
T
- Enum type evaluatedobj
- object to evaluateenumType
- The desired enum class
public static <T extends java.lang.Enum<T>> T enumValueWithRequiredDefault(java.lang.Object obj, T def)
T
- enum type evaluatedobj
- object to be evaluateddef
- default value returned if object is null. If this value is null,
the method throws a NullPointerException
public static <T extends java.lang.Enum<T>> T enumValueWithDefault(java.lang.Object obj, java.lang.Class<T> enumType, T def)
T
- Enum type evaluatedobj
- object to evaluateenumType
- The desired enum classdef
- default value returned if obj is null.
|
Last updated: Tue, Feb 21, 2017 05:45 PM CET | |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |