public class ERXValueUtilities extends Object
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 and Description |
---|
ERXValueUtilities() |
Modifier and Type | Method and Description |
---|---|
static NSArray |
arrayValue(Object obj)
Basic utility method for reading NSArray values which works also with
Strings.
|
static NSArray |
arrayValueWithDefault(Object obj,
NSArray def)
Basic utility method for reading
NSArray values which also
works with serialized NSArrays and comma separated items. |
static BigDecimal |
bigDecimalValue(Object obj)
Basic utility method for reading BigDecimal values which works also with
Strings.
|
static BigDecimal |
bigDecimalValueWithDefault(Object obj,
BigDecimal def)
Basic utility method for reading
BigDecimal values. |
static boolean |
booleanValue(Object obj)
Basic utility method for determining if an object represents either a
true or false value.
|
static boolean |
booleanValueWithDefault(Object obj,
boolean def)
Basic utility method for determining if an object represents either a
true or false value.
|
static Boolean |
BooleanValueWithDefault(Object obj,
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(Object obj)
Basic utility method for reading NSData values which works also with
Strings.
|
static com.webobjects.foundation.NSData |
dataValueWithDefault(Object obj,
com.webobjects.foundation.NSData def)
Basic utility method for reading
NSData values which also
works with serialized NSData. |
static NSDictionary |
dictionaryValue(Object obj)
Basic utility method for reading NSDictionary values which works also
with Strings.
|
static NSDictionary |
dictionaryValueWithDefault(Object obj,
NSDictionary def)
Basic utility method for reading
NSDictionary values which
also works with serialized NSDictionarys. |
static double |
doubleValue(Object obj)
Basic utility method for reading double values.
|
static double |
doubleValueWithDefault(Object obj,
double def)
Basic utility method for reading
double values. |
static Double |
DoubleValueWithDefault(Object obj,
Double def)
Basic utility method for reading
Double values. |
static <T extends Enum<T>> |
enumValue(Object obj,
Class<T> enumType)
Basic utility method for reading Enum values.
|
static <T extends Enum<T>> |
enumValueWithDefault(Object obj,
Class<T> enumType,
T def)
Basic utility method for reading Enum values.
|
static <T extends Enum<T>> |
enumValueWithRequiredDefault(Object obj,
T def)
Basic utility method for reading Enum values.
|
static float |
floatValue(Object obj)
Basic utility method for reading float values.
|
static float |
floatValueWithDefault(Object obj,
float def)
Basic utility method for reading
float values. |
static Float |
FloatValueWithDefault(Object obj,
Float def)
Basic utility method for reading
Float values. |
static Integer |
IntegerValueWithDefault(Object obj,
Integer def)
Basic utility method for reading
Integer values. |
static int |
intValue(Object obj)
Basic utility method for reading int values.
|
static int |
intValueWithDefault(Object obj,
int def)
Basic utility method for reading
int values. |
static boolean |
isNull(Object obj)
Returns whether or not the given object is null or NSKVC.Null.
|
static long |
longValue(Object obj)
Basic utility method for reading long values.
|
static long |
longValueWithDefault(Object obj,
long def)
Basic utility method for reading
long values. |
static Long |
LongValueWithDefault(Object obj,
Long def)
Basic utility method for reading
Long values. |
static Object[] |
objectsToObjectArray(Object... anyObjects)
複数のオブジェクトをオブジェクト配列として返す
|
static NSSet |
setValue(Object obj)
Basic utility method for reading NSSet values which works also with
Strings.
|
static NSSet |
setValueWithDefault(Object obj,
NSSet def)
Basic utility method for reading
NSSet values which also
works with serialized NSSets and comma separated items. |
static String |
stringArrayToString(String[] sa)
文字列配列を「,」で連結して返す。
|
static String[] |
stringsToStringArray(String... anyStrings)
複数の文字列を文字列配列として返す
|
public static boolean isNull(Object obj)
obj
- the object to checkpublic static boolean booleanValue(Object obj)
0
, Strings are false if they equal (case insensitive) 'no',
'false' or parse to 0.obj
- object to be evaluatedpublic static boolean booleanValueWithDefault(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 nullpublic static Boolean BooleanValueWithDefault(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 nullpublic static int intValue(Object obj)
intValueWithDefault(Object, int)
with a default of
0
.obj
- object to be evaluatedpublic static int intValueWithDefault(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 nullpublic static Integer IntegerValueWithDefault(Object obj, 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 nullpublic static float floatValue(Object obj)
floatValueWithDefault(Object, float)
with a default of
0
.obj
- object to be evaluatedpublic static float floatValueWithDefault(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 nullpublic static Float FloatValueWithDefault(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 nullpublic static double doubleValue(Object obj)
doubleValueWithDefault(Object, double)
with
a default of 0
.obj
- object to be evaluatedpublic static double doubleValueWithDefault(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 nullpublic static Double DoubleValueWithDefault(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 nullpublic static long longValue(Object obj)
longValueWithDefault(Object, long)
with a default of
0
.obj
- object to be evaluatedpublic static long longValueWithDefault(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 nullpublic static Long LongValueWithDefault(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 nullpublic static NSArray arrayValue(Object obj)
arrayValueWithDefault(Object, NSArray)
with a default of
null
.obj
- object to be evaluatedpublic static NSArray arrayValueWithDefault(Object obj, 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 nullpublic static NSSet setValue(Object obj)
setValueWithDefault(Object, NSSet)
with a default of
null
.obj
- object to be evaluatedpublic static NSSet setValueWithDefault(Object obj, 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 nullpublic static NSDictionary dictionaryValue(Object obj)
dictionaryValueWithDefault(Object, NSDictionary)
with a default
of null
.obj
- object to be evaluatedpublic static NSDictionary dictionaryValueWithDefault(Object obj, 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 nullpublic static com.webobjects.foundation.NSData dataValue(Object obj)
dataValueWithDefault(Object, NSData)
with a default of
null
.obj
- object to be evaluatedpublic static com.webobjects.foundation.NSData dataValueWithDefault(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 nullpublic static BigDecimal bigDecimalValue(Object obj)
bigDecimalValueWithDefault(Object, BigDecimal)
with a default of
null
.obj
- object to be evaluatedpublic static BigDecimal bigDecimalValueWithDefault(Object obj, BigDecimal def)
BigDecimal
values. The
default value is used if the object is null.obj
- object to be evaluateddef
- default value if object is nullpublic static int compare(int int1, int int2)
int1
- value 1int2
- value 2public static <T extends Enum<T>> T enumValue(Object obj, Class<T> enumType)
T
- Enum type evaluatedobj
- object to evaluateenumType
- The desired enum classpublic static <T extends Enum<T>> T enumValueWithRequiredDefault(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 NullPointerExceptionpublic static <T extends Enum<T>> T enumValueWithDefault(Object obj, Class<T> enumType, T def)
T
- Enum type evaluatedobj
- object to evaluateenumType
- The desired enum classdef
- default value returned if obj is null.public static String[] stringsToStringArray(String... anyStrings)
anyStrings
- - 複数の文字列public static Object[] objectsToObjectArray(Object... anyObjects)
anyObjects
- - 複数のオブジェクトCopyright © 2002 – 2020 Project Wonder.