public class DataValue extends Object implements Cloneable, Serializable, Comparable
In addition to the value itself, a DataValue tracks the data type, whether the value is an array-type, and whether the value is null. The class also provides methods to retrieve the value as various Java types, such as int, Integer, or String (not all of these are available for all DataValue data types). All of these conversion methods take an optional (nullable) DataValueLocalizer argument, used to perform any needed localization (specifically, parsing and formatting numbers and dates).
DataValues also track the name of the data element whose value they
represent. After you use a newDataValue
method to create
a DataValue, you can invoke the setName
method to set its
name. This is optional, and is only useful when the DataValue instance
will later be used in a context where the name is relevant.
Note that once a DataValue's name is set, it cannot be altered
except in limited ways using the ensureUpperCaseName
and
overrideName
methods.
Modifier and Type | Field and Description |
---|---|
static int |
DATATYPE_BOOLEAN
The data type of boolean values.
|
static int |
DATATYPE_BOOLEAN_ARRAY
The data type of array-type boolean values.
|
static int |
DATATYPE_DATE
The data type of date values.
|
static int |
DATATYPE_DATE_ARRAY
The data type of array-type date values.
|
static int |
DATATYPE_DOUBLE
The data type of double values.
|
static int |
DATATYPE_DOUBLE_ARRAY
The data type of array-type double values.
|
static int |
DATATYPE_INTEGER
The data type of integer values.
|
static int |
DATATYPE_INTEGER_ARRAY
The data type of array-type integer values.
|
static String |
DATATYPE_LABEL_BOOLEAN
The label for boolean datatype.
|
static String |
DATATYPE_LABEL_BOOLEAN_ARRAY
The label for boolean array datatype.
|
static String |
DATATYPE_LABEL_DATE
The label for date datatype.
|
static String |
DATATYPE_LABEL_DATE_ARRAY
The label for date array datatype.
|
static String |
DATATYPE_LABEL_DOUBLE
The label for double datatype.
|
static String |
DATATYPE_LABEL_DOUBLE_ARRAY
The label for double array datatype.
|
static String |
DATATYPE_LABEL_INTEGER
The label for integer datatype.
|
static String |
DATATYPE_LABEL_INTEGER_ARRAY
The label for integer array datatype.
|
static String |
DATATYPE_LABEL_LONG
The label for long datatype.
|
static String |
DATATYPE_LABEL_LONG_ARRAY
The label for long array datatype.
|
static String |
DATATYPE_LABEL_STRING
The label for string datatype.
|
static String |
DATATYPE_LABEL_STRING_ARRAY
The label for string array datatype.
|
static String |
DATATYPE_LABEL_UNKNOWN
The label for unknown datatype.
|
static int |
DATATYPE_LONG
The data type of long values.
|
static int |
DATATYPE_LONG_ARRAY
The data type of array-type long values.
|
static int |
DATATYPE_STRING
The data type of string values.
|
static int |
DATATYPE_STRING_ARRAY
The data type of array-type string values.
|
static int |
DATATYPE_UNKNOWN
An unknown data type.
|
static Long |
LONG_ZERO
Constant for a Long representation of zero, commonly
used in some cases to indicate essentially a null numeric setting.
|
Modifier | Constructor and Description |
---|---|
protected |
DataValue()
Constructs a null DataValue of an unknown data type.
|
Modifier and Type | Method and Description |
---|---|
static Hashtable |
arrayToHashtable(DataValue[] values)
Converts an array of DataValues to a Hashtable, hashed by name.
|
int |
compareTo(Object o)
Compares two DataValues.
|
protected boolean |
convertToBoolean(DataValueLocalizer localizer,
int index)
Converts this DataValue to a boolean.
|
protected boolean[] |
convertToBooleanArray(DataValueLocalizer localizer)
Converts this DataValue to an array of booleans.
|
protected Boolean |
convertToBooleanObject(DataValueLocalizer localizer,
int index)
Converts this DataValue to a Boolean.
|
protected Boolean[] |
convertToBooleanObjectArray(DataValueLocalizer localizer)
Converts this DataValue to an array of Booleans.
|
protected Date |
convertToDate(DataValueLocalizer localizer,
int index)
Converts this DataValue to a Date.
|
protected Date[] |
convertToDateArray(DataValueLocalizer localizer)
Converts this DataValue to an array of Dates.
|
protected double |
convertToDouble(DataValueLocalizer localizer,
int index)
Converts this DataValue to a double.
|
protected double[] |
convertToDoubleArray(DataValueLocalizer localizer)
Converts this DataValue to an array of doubles.
|
protected Double |
convertToDoubleObject(DataValueLocalizer localizer,
int index)
Converts this DataValue to a Double.
|
protected Double[] |
convertToDoubleObjectArray(DataValueLocalizer localizer)
Converts this DataValue to an array of Doubles.
|
protected int |
convertToInteger(DataValueLocalizer localizer,
int index)
Converts this DataValue to an int.
|
protected int[] |
convertToIntegerArray(DataValueLocalizer localizer)
Converts this DataValue to an array of ints.
|
protected Integer |
convertToIntegerObject(DataValueLocalizer localizer,
int index)
Converts this DataValue to an Integer.
|
protected Integer[] |
convertToIntegerObjectArray(DataValueLocalizer localizer)
Converts this DataValue to an array of Integers.
|
protected long |
convertToLong(DataValueLocalizer localizer,
int index)
Converts this DataValue to a long.
|
protected long[] |
convertToLongArray(DataValueLocalizer localizer)
Converts this DataValue to an array of longs.
|
protected Long |
convertToLongObject(DataValueLocalizer localizer,
int index)
Converts this DataValue to a Long.
|
protected Long[] |
convertToLongObjectArray(DataValueLocalizer localizer)
Converts this DataValue to an array of Longs.
|
protected String |
convertToString(DataValueLocalizer localizer,
int index)
Converts this DataValue to a String.
|
protected String[] |
convertToStringArray(DataValueLocalizer localizer)
Converts this DataValue to an array of Strings.
|
void |
ensureUpperCaseName()
Ensures the name of this DataValue (if any) is uppercase.
|
boolean |
getBoolean()
Gets this DataValue's representation as a boolean.
|
boolean |
getBoolean(DataValueLocalizer localizer)
Gets this DataValue's representation as a boolean.
|
boolean[] |
getBooleanArray()
Gets this DataValue's representation as an array of booleans.
|
boolean[] |
getBooleanArray(DataValueLocalizer localizer)
Gets this DataValue's representation as an array of booleans.
|
boolean |
getBooleanArray(DataValueLocalizer localizer,
int index)
Get the specified element of this DataValue's representation
as an array of booleans.
|
boolean |
getBooleanArray(int index)
Get the specified element of this DataValue's representation
as an array of booleans.
|
Boolean |
getBooleanObject()
Gets this DataValue's representation as a Boolean.
|
Boolean |
getBooleanObject(DataValueLocalizer localizer)
Gets this DataValue's representation as a Boolean.
|
Boolean[] |
getBooleanObjectArray()
Gets this DataValue's representation as an array of Booleans.
|
Boolean[] |
getBooleanObjectArray(DataValueLocalizer localizer)
Gets this DataValue's representation as an array of Booleans.
|
Boolean |
getBooleanObjectArray(DataValueLocalizer localizer,
int index)
Get the specified element of this DataValue's representation
as an array of Booleans.
|
Boolean |
getBooleanObjectArray(int index)
Get the specified element of this DataValue's representation
as an array of Booleans.
|
int |
getDataType()
Gets the data type of this DataValue.
|
String |
getDataTypeLabel()
Gets the label for the data type associated with this DataValue.
|
static String |
getDataTypeLabel(int dataType)
Gets the label for the specified data type.
|
Date |
getDate()
Gets this DataValue's representation as a Date.
|
Date |
getDate(DataValueLocalizer localizer)
Gets this DataValue's representation as a Date.
|
Date[] |
getDateArray()
Gets this DataValue's representation as an array of Dates.
|
Date[] |
getDateArray(DataValueLocalizer localizer)
Gets this DataValue's representation as an array of Dates.
|
Date |
getDateArray(DataValueLocalizer localizer,
int index)
Get the specified element of this DataValue's representation
as an array of Dates.
|
Date |
getDateArray(int index)
Get the specified element of this DataValue's representation
as an array of Dates.
|
double |
getDouble()
Gets this DataValue's representation as a double.
|
double |
getDouble(DataValueLocalizer localizer)
Gets this DataValue's representation as a double.
|
double[] |
getDoubleArray()
Gets this DataValue's representation as an array of doubles.
|
double[] |
getDoubleArray(DataValueLocalizer localizer)
Gets this DataValue's representation as an array of doubles.
|
double |
getDoubleArray(DataValueLocalizer localizer,
int index)
Get the specified element of this DataValue's representation
as an array of doubles.
|
double |
getDoubleArray(int index)
Get the specified element of this DataValue's representation
as an array of doubles.
|
Double |
getDoubleObject()
Gets this DataValue's representation as a Double.
|
Double |
getDoubleObject(DataValueLocalizer localizer)
Gets this DataValue's representation as a Double.
|
Double[] |
getDoubleObjectArray()
Gets this DataValue's representation as an array of Doubles.
|
Double[] |
getDoubleObjectArray(DataValueLocalizer localizer)
Gets this DataValue's representation as an array of Doubles.
|
Double |
getDoubleObjectArray(DataValueLocalizer localizer,
int index)
Get the specified element of this DataValue's representation
as an array of Doubles.
|
Double |
getDoubleObjectArray(int index)
Get the specified element of this DataValue's representation
as an array of Doubles.
|
int |
getElementCount()
Gets the number of elements in an array-type DataValue.
|
int |
getInteger()
Gets this DataValue's representation as an int.
|
int |
getInteger(DataValueLocalizer localizer)
Gets this DataValue's representation as an int.
|
int[] |
getIntegerArray()
Gets this DataValue's representation as an array of ints.
|
int[] |
getIntegerArray(DataValueLocalizer localizer)
Gets this DataValue's representation as an array of ints.
|
int |
getIntegerArray(DataValueLocalizer localizer,
int index)
Get the specified element of this DataValue's representation
as an array of ints.
|
int |
getIntegerArray(int index)
Get the specified element of this DataValue's representation
as an array of ints.
|
Integer |
getIntegerObject()
Gets this DataValue's representation as an Integer.
|
Integer |
getIntegerObject(DataValueLocalizer localizer)
Gets this DataValue's representation as an Integer.
|
Integer[] |
getIntegerObjectArray()
Gets this DataValue's representation as an array of Integers.
|
Integer[] |
getIntegerObjectArray(DataValueLocalizer localizer)
Gets this DataValue's representation as an array of Integers.
|
Integer |
getIntegerObjectArray(DataValueLocalizer localizer,
int index)
Get the specified element of this DataValue's representation
as an array of Integers.
|
Integer |
getIntegerObjectArray(int index)
Get the specified element of this DataValue's representation
as an array of Integers.
|
long |
getLong()
Gets this DataValue's representation as a long.
|
long |
getLong(DataValueLocalizer localizer)
Gets this DataValue's representation as a long.
|
long[] |
getLongArray()
Gets this DataValue's representation as an array of longs.
|
long[] |
getLongArray(DataValueLocalizer localizer)
Gets this DataValue's representation as an array of longs.
|
long |
getLongArray(DataValueLocalizer localizer,
int index)
Get the specified element of this DataValue's representation
as an array of longs.
|
long |
getLongArray(int index)
Get the specified element of this DataValue's representation
as an array of longs.
|
Long |
getLongObject()
Gets this DataValue's representation as a Long.
|
Long |
getLongObject(DataValueLocalizer localizer)
Gets this DataValue's representation as a Long.
|
Long[] |
getLongObjectArray()
Gets this DataValue's representation as an array of Longs.
|
Long[] |
getLongObjectArray(DataValueLocalizer localizer)
Gets this DataValue's representation as an array of Longs.
|
Long |
getLongObjectArray(DataValueLocalizer localizer,
int index)
Get the specified element of this DataValue's representation
as an array of Longs.
|
Long |
getLongObjectArray(int index)
Get the specified element of this DataValue's representation
as an array of Longs.
|
String |
getName()
Gets the name of this DataValue.
|
Object |
getObject(DataValueLocalizer localizer)
Gets the default object representation of this DataValue.
|
String |
getString()
Gets this DataValue's representation as a String.
|
String |
getString(DataValueLocalizer localizer)
Gets this DataValue's representation as a String.
|
String[] |
getStringArray()
Gets this DataValue's representation as an array of Strings.
|
String[] |
getStringArray(DataValueLocalizer localizer)
Gets this DataValue's representation as an array of Strings.
|
String |
getStringArray(DataValueLocalizer localizer,
int index)
Get the specified element of this DataValue's representation
as an array of Strings.
|
String |
getStringArray(int index)
Get the specified element of this DataValue's representation
as an array of Strings.
|
static DataValue[] |
hashtableToArray(Hashtable ht)
Converts a hash table of DataValues to an array.
|
boolean |
isArrayType()
Gets whether this DataValue is an array-type DataValue.
|
static boolean |
isArrayType(int dataType)
Gets whether this DataValue is an array-type DataValue.
|
boolean |
isNullValue()
Gets whether this DataValue is null.
|
static DataValue |
newDataValue()
Constructs a null DataValue of an unknown data type.
|
static DataValue |
newDataValue(boolean value)
Constructs a new boolean DataValue.
|
static DataValue |
newDataValue(Boolean value)
Constructs a new boolean DataValue.
|
static DataValue |
newDataValue(boolean[] values)
Constructs a new array-type boolean DataValue.
|
static DataValue |
newDataValue(Boolean[] values)
Constructs a new array-type boolean DataValue.
|
static DataValue |
newDataValue(DataValue dv)
Constructs a new DataValue identical to the specified
DataValue except with no name.
|
static DataValue |
newDataValue(Date value)
Constructs a new date DataValue.
|
static DataValue |
newDataValue(Date[] values)
Constructs a new array-type date DataValue.
|
static DataValue |
newDataValue(double value)
Constructs a new double DataValue.
|
static DataValue |
newDataValue(Double value)
Constructs a new double DataValue.
|
static DataValue |
newDataValue(double[] values)
Constructs a new array-type double DataValue.
|
static DataValue |
newDataValue(Double[] values)
Constructs a new array-type double DataValue.
|
static DataValue |
newDataValue(int value)
Constructs a new integer DataValue.
|
static DataValue |
newDataValue(int[] values)
Constructs a new array-type integer DataValue.
|
static DataValue |
newDataValue(Integer value)
Constructs a new integer DataValue.
|
static DataValue |
newDataValue(Integer[] values)
Constructs a new array-type integer DataValue.
|
static DataValue |
newDataValue(long value)
Constructs a new long DataValue.
|
static DataValue |
newDataValue(Long value)
Constructs a new long DataValue.
|
static DataValue |
newDataValue(long[] values)
Constructs a new array-type long DataValue.
|
static DataValue |
newDataValue(Long[] values)
Constructs a new array-type long DataValue.
|
static DataValue |
newDataValue(Long id,
int dataType)
Internal use only: Constructs a new DataValue of the specified data
type for the specified id.
|
static DataValue |
newDataValue(Object value)
Constructs a new DataValue for the specified object.
|
static DataValue |
newDataValue(String value)
Constructs a new string DataValue.
|
static DataValue |
newDataValue(String[] values)
Constructs a new array-type string DataValue.
|
static DataValue |
newNullDataValue(int dataType)
Constructs a null DataValue of the specified data type.
|
static DataValue |
overrideName(String name,
DataValue dv)
Overrides the name set for this DataValue by cloning
the DataValue if the name is already set.
|
void |
setName(String name)
Sets the name of this DataValue.
|
protected Boolean |
toBoolean(Double value,
DataValueLocalizer localizer)
Converts a Double to a Boolean.
|
protected Boolean |
toBoolean(Integer value,
DataValueLocalizer localizer)
Converts an Integer to a Boolean.
|
protected Boolean |
toBoolean(Long value,
DataValueLocalizer localizer)
Converts a Long to a Boolean.
|
protected Boolean |
toBoolean(String value,
DataValueLocalizer localizer)
Converts a String to a Boolean.
|
protected Date |
toDate(Date value,
DataValueLocalizer localizer)
Converts a Date to a Date (creates a clone).
|
protected Date |
toDate(String value,
DataValueLocalizer localizer)
Converts a String to a Date.
|
protected Double |
toDouble(Boolean value,
DataValueLocalizer localizer)
Converts a Boolean to a Double.
|
protected Double |
toDouble(Number value,
DataValueLocalizer localizer)
Converts a Number to a Double.
|
protected Double |
toDouble(String value,
DataValueLocalizer localizer)
Converts a String to a Double.
|
protected Integer |
toInteger(Boolean value,
DataValueLocalizer localizer)
Converts a Boolean to an Integer.
|
protected Integer |
toInteger(Number value,
DataValueLocalizer localizer)
Converts a Number to an Integer.
|
protected Integer |
toInteger(String value,
DataValueLocalizer localizer)
Converts a String to an Integer.
|
protected Long |
toLong(Boolean value,
DataValueLocalizer localizer)
Converts a Boolean to a Long.
|
protected Long |
toLong(Date value,
DataValueLocalizer localizer)
Converts a Date to a Long.
|
protected Long |
toLong(Number value,
DataValueLocalizer localizer)
Converts a Number to a Long.
|
protected Long |
toLong(String value,
DataValueLocalizer localizer)
Converts a String to a Long.
|
static int |
toSqlType(int dataType)
Gets the SQL (JDBC) type for the specified data type.
|
String |
toString()
Gets the default object representation of this DataValue as a
string.
|
protected String |
toString(Boolean value,
DataValueLocalizer localizer)
Converts a Boolean to a String.
|
String |
toString(DataValueLocalizer localizer)
Gets the default object representation of this DataValue as a
string.
|
protected String |
toString(Date value,
DataValueLocalizer localizer)
Converts a Date to a String.
|
protected String |
toString(Double value,
DataValueLocalizer localizer)
Converts a Double to a String.
|
protected String |
toString(Integer value,
DataValueLocalizer localizer)
Converts an Integer to a String.
|
protected String |
toString(Long value,
DataValueLocalizer localizer)
Converts a Long to a String.
|
public static final int DATATYPE_UNKNOWN
public static final int DATATYPE_DATE
public static final int DATATYPE_STRING
public static final int DATATYPE_DOUBLE
public static final int DATATYPE_INTEGER
public static final int DATATYPE_BOOLEAN
public static final int DATATYPE_LONG
public static final int DATATYPE_DATE_ARRAY
public static final int DATATYPE_STRING_ARRAY
public static final int DATATYPE_DOUBLE_ARRAY
public static final int DATATYPE_INTEGER_ARRAY
public static final int DATATYPE_BOOLEAN_ARRAY
public static final int DATATYPE_LONG_ARRAY
public static final String DATATYPE_LABEL_UNKNOWN
public static final String DATATYPE_LABEL_DATE
public static final String DATATYPE_LABEL_STRING
public static final String DATATYPE_LABEL_DOUBLE
public static final String DATATYPE_LABEL_INTEGER
public static final String DATATYPE_LABEL_BOOLEAN
public static final String DATATYPE_LABEL_LONG
public static final String DATATYPE_LABEL_DATE_ARRAY
public static final String DATATYPE_LABEL_STRING_ARRAY
public static final String DATATYPE_LABEL_DOUBLE_ARRAY
public static final String DATATYPE_LABEL_INTEGER_ARRAY
public static final String DATATYPE_LABEL_BOOLEAN_ARRAY
public static final String DATATYPE_LABEL_LONG_ARRAY
public static final Long LONG_ZERO
protected DataValue()
public static final DataValue newDataValue(int value)
value
- the integer valuepublic static final DataValue newDataValue(Integer value)
value
- the integer valuepublic static final DataValue newDataValue(long value)
value
- the long valuepublic static final DataValue newDataValue(Long value)
value
- the long valuepublic static final DataValue newDataValue(double value)
value
- the double valuepublic static final DataValue newDataValue(Double value)
value
- the double valuepublic static final DataValue newDataValue(String value)
value
- the string valuepublic static final DataValue newDataValue(Date value)
value
- the date valuepublic static final DataValue newDataValue(boolean value)
value
- the boolean valuepublic static final DataValue newDataValue(Boolean value)
value
- the boolean valuepublic static final DataValue newDataValue(int[] values)
values
- the integer valuespublic static final DataValue newDataValue(Integer[] values)
values
- the integer valuespublic static final DataValue newDataValue(long[] values)
values
- the long valuespublic static final DataValue newDataValue(Long[] values)
values
- the long valuespublic static final DataValue newDataValue(double[] values)
values
- the double valuespublic static final DataValue newDataValue(Double[] values)
values
- the double valuespublic static final DataValue newDataValue(String[] values)
values
- the string valuespublic static final DataValue newDataValue(Date[] values)
values
- the date valuespublic static final DataValue newDataValue(boolean[] values)
values
- the boolean valuespublic static final DataValue newDataValue(Boolean[] values)
values
- the boolean valuespublic static final DataValue newDataValue(Long id, int dataType)
For internal use only. Do not call this method.
id
- the iddataType
- the data typepublic static final DataValue newDataValue(DataValue dv)
dv
- the existing DataValuepublic static final DataValue newDataValue(Object value)
value
- the objectpublic static final DataValue newDataValue()
public static final DataValue newNullDataValue(int dataType)
newNullDataValue(DATATYPE_STRING)
is equivalent to newDataValue((String)null)
.
dataType
- the data typepublic final int getInteger()
public final int getInteger(DataValueLocalizer localizer)
localizer
- the localizerpublic final Integer getIntegerObject()
public final Integer getIntegerObject(DataValueLocalizer localizer)
localizer
- the localizerpublic final long getLong()
public final long getLong(DataValueLocalizer localizer)
localizer
- the localizerpublic final Long getLongObject()
public final Long getLongObject(DataValueLocalizer localizer)
localizer
- the localizerpublic final double getDouble()
public final double getDouble(DataValueLocalizer localizer)
localizer
- the localizerpublic final Double getDoubleObject()
public final Double getDoubleObject(DataValueLocalizer localizer)
localizer
- the localizerpublic final String getString()
public final String getString(DataValueLocalizer localizer)
localizer
- the localizerpublic final Date getDate()
public final Date getDate(DataValueLocalizer localizer)
localizer
- the localizerpublic final boolean getBoolean()
public final boolean getBoolean(DataValueLocalizer localizer)
localizer
- the localizerpublic final Boolean getBooleanObject()
public final Boolean getBooleanObject(DataValueLocalizer localizer)
localizer
- the localizerpublic final int[] getIntegerArray()
public final int[] getIntegerArray(DataValueLocalizer localizer)
localizer
- the localizerpublic final Integer[] getIntegerObjectArray()
public final Integer[] getIntegerObjectArray(DataValueLocalizer localizer)
localizer
- the localizerpublic final long[] getLongArray()
public final long[] getLongArray(DataValueLocalizer localizer)
localizer
- the localizerpublic final Long[] getLongObjectArray()
public final Long[] getLongObjectArray(DataValueLocalizer localizer)
localizer
- the localizerpublic final double[] getDoubleArray()
public final double[] getDoubleArray(DataValueLocalizer localizer)
localizer
- the localizerpublic final Double[] getDoubleObjectArray()
public final Double[] getDoubleObjectArray(DataValueLocalizer localizer)
localizer
- the localizerpublic final String[] getStringArray()
public final String[] getStringArray(DataValueLocalizer localizer)
localizer
- the localizerpublic final Date[] getDateArray()
public final Date[] getDateArray(DataValueLocalizer localizer)
localizer
- the localizerpublic final boolean[] getBooleanArray()
public final boolean[] getBooleanArray(DataValueLocalizer localizer)
localizer
- the localizerpublic final Boolean[] getBooleanObjectArray()
public final Boolean[] getBooleanObjectArray(DataValueLocalizer localizer)
localizer
- the localizerpublic final int getIntegerArray(int index)
index
- the zero-based indexpublic final int getIntegerArray(DataValueLocalizer localizer, int index)
localizer
- the localizerindex
- the zero-based indexpublic final Integer getIntegerObjectArray(int index)
index
- the zero-based indexpublic final Integer getIntegerObjectArray(DataValueLocalizer localizer, int index)
localizer
- the localizerindex
- the zero-based indexpublic final long getLongArray(int index)
index
- the zero-based indexpublic final long getLongArray(DataValueLocalizer localizer, int index)
localizer
- the localizerindex
- the zero-based indexpublic final Long getLongObjectArray(int index)
index
- the zero-based indexpublic final Long getLongObjectArray(DataValueLocalizer localizer, int index)
localizer
- the localizerindex
- the zero-based indexpublic final double getDoubleArray(int index)
index
- the zero-based indexpublic final double getDoubleArray(DataValueLocalizer localizer, int index)
localizer
- the localizerindex
- the zero-based indexpublic final Double getDoubleObjectArray(int index)
index
- the zero-based indexpublic final Double getDoubleObjectArray(DataValueLocalizer localizer, int index)
localizer
- the localizerindex
- the zero-based indexpublic final String getStringArray(int index)
index
- the zero-based indexpublic final String getStringArray(DataValueLocalizer localizer, int index)
localizer
- the localizerindex
- the zero-based indexpublic final Date getDateArray(int index)
index
- the zero-based indexpublic final Date getDateArray(DataValueLocalizer localizer, int index)
localizer
- the localizerindex
- the zero-based indexpublic final boolean getBooleanArray(int index)
index
- the zero-based indexpublic final boolean getBooleanArray(DataValueLocalizer localizer, int index)
localizer
- the localizerindex
- the zero-based indexpublic final Boolean getBooleanObjectArray(int index)
index
- the zero-based indexpublic final Boolean getBooleanObjectArray(DataValueLocalizer localizer, int index)
localizer
- the localizerindex
- the zero-based indexpublic final void setName(String name)
A RuntimeException will be thrown if the instance's name is already set.
name
- the string namepublic static final DataValue overrideName(String name, DataValue dv)
name
- the namedv
- the DataValuepublic final void ensureUpperCaseName()
public final String getName()
public int getDataType()
public String getDataTypeLabel()
public static String getDataTypeLabel(int dataType)
dataType
- the datatypepublic final boolean isArrayType()
public static final boolean isArrayType(int dataType)
dataType
- the data type to checkpublic boolean isNullValue()
public int getElementCount()
public Object getObject(DataValueLocalizer localizer)
For example, the default object representation of a boolean DataValue is a Java Boolean.
localizer
- the localizerpublic final String toString()
Equivalent to getObject(null).toString()
. Unlike the
getString
method, the returned string is completely
unformatted and unlocalized.
public final String toString(DataValueLocalizer localizer)
Equivalent to getObject(localizer).toString()
. Unlike the
getString
method, the returned string is completely
unformatted and unlocalized.
public static final DataValue[] hashtableToArray(Hashtable ht)
If a null Hastable is specified, a null value is returned as the array. Otherwise the length of the returned array will be equal to the size of the Hashtable.
ht
- the Hashtable of DataValuespublic static final Hashtable arrayToHashtable(DataValue[] values)
DataValues whose name is unset are ignored, and not reflected in the Hashtable returned.
values
- an array of DataValuesprotected int convertToInteger(DataValueLocalizer localizer, int index)
localizer
- the localizerindex
- the zero-based indexprotected Integer convertToIntegerObject(DataValueLocalizer localizer, int index)
localizer
- the localizerindex
- the zero-based indexprotected long convertToLong(DataValueLocalizer localizer, int index)
localizer
- the localizerindex
- the zero-based indexprotected Long convertToLongObject(DataValueLocalizer localizer, int index)
localizer
- the localizerindex
- the zero-based indexprotected double convertToDouble(DataValueLocalizer localizer, int index)
localizer
- the localizerindex
- the zero-based indexprotected Double convertToDoubleObject(DataValueLocalizer localizer, int index)
localizer
- the localizerindex
- the zero-based indexprotected String convertToString(DataValueLocalizer localizer, int index)
localizer
- the localizerindex
- the zero-based indexprotected Date convertToDate(DataValueLocalizer localizer, int index)
localizer
- the localizerindex
- the zero-based indexprotected boolean convertToBoolean(DataValueLocalizer localizer, int index)
localizer
- the localizerindex
- the zero-based indexprotected Boolean convertToBooleanObject(DataValueLocalizer localizer, int index)
localizer
- the localizerindex
- the zero-based indexprotected int[] convertToIntegerArray(DataValueLocalizer localizer)
localizer
- the localizerprotected Integer[] convertToIntegerObjectArray(DataValueLocalizer localizer)
localizer
- the localizerprotected long[] convertToLongArray(DataValueLocalizer localizer)
localizer
- the localizerprotected Long[] convertToLongObjectArray(DataValueLocalizer localizer)
localizer
- the localizerprotected double[] convertToDoubleArray(DataValueLocalizer localizer)
localizer
- the localizerprotected Double[] convertToDoubleObjectArray(DataValueLocalizer localizer)
localizer
- the localizerprotected String[] convertToStringArray(DataValueLocalizer localizer)
localizer
- the localizerprotected Date[] convertToDateArray(DataValueLocalizer localizer)
localizer
- the localizerprotected boolean[] convertToBooleanArray(DataValueLocalizer localizer)
localizer
- the localizerprotected Boolean[] convertToBooleanObjectArray(DataValueLocalizer localizer)
localizer
- the localizerprotected final Integer toInteger(Number value, DataValueLocalizer localizer)
value
- the Numberlocalizer
- the DataValueLocalizer to useprotected final Integer toInteger(Boolean value, DataValueLocalizer localizer)
value
- the Booleanlocalizer
- the DataValueLocalizer to useprotected final Integer toInteger(String value, DataValueLocalizer localizer)
value
- the Stringlocalizer
- the DataValueLocalizer to useprotected final Long toLong(Number value, DataValueLocalizer localizer)
value
- the Numberlocalizer
- the DataValueLocalizer to useprotected final Long toLong(Boolean value, DataValueLocalizer localizer)
value
- the Booleanlocalizer
- the DataValueLocalizer to useprotected final Long toLong(Date value, DataValueLocalizer localizer)
value
- the Datelocalizer
- the DataValueLocalizer to useprotected final Long toLong(String value, DataValueLocalizer localizer)
value
- the Stringlocalizer
- the DataValueLocalizer to useprotected final Double toDouble(Number value, DataValueLocalizer localizer)
value
- the Numberlocalizer
- the DataValueLocalizer to useprotected final Double toDouble(Boolean value, DataValueLocalizer localizer)
value
- the Booleanlocalizer
- the DataValueLocalizer to useprotected final Double toDouble(String value, DataValueLocalizer localizer)
value
- the Stringlocalizer
- the DataValueLocalizer to useprotected final Boolean toBoolean(Integer value, DataValueLocalizer localizer)
value
- the Integerlocalizer
- the DataValueLocalizer to useprotected final Boolean toBoolean(Long value, DataValueLocalizer localizer)
value
- the Longlocalizer
- the DataValueLocalizer to useprotected final Boolean toBoolean(Double value, DataValueLocalizer localizer)
value
- the Doublelocalizer
- the DataValueLocalizer to useprotected final Boolean toBoolean(String value, DataValueLocalizer localizer)
value
- the Stringlocalizer
- the DataValueLocalizer to useprotected final String toString(Integer value, DataValueLocalizer localizer)
value
- the Integerlocalizer
- the DataValueLocalizer to useprotected final String toString(Long value, DataValueLocalizer localizer)
value
- the Longlocalizer
- the DataValueLocalizer to useprotected final String toString(Double value, DataValueLocalizer localizer)
value
- the Doublelocalizer
- the DataValueLocalizer to useprotected final String toString(Boolean value, DataValueLocalizer localizer)
value
- the Booleanlocalizer
- the DataValueLocalizer to useprotected final String toString(Date value, DataValueLocalizer localizer)
value
- the Datelocalizer
- the DataValueLocalizer to useprotected final Date toDate(String value, DataValueLocalizer localizer)
value
- the Stringlocalizer
- the DataValueLocalizer to useprotected final Date toDate(Date value, DataValueLocalizer localizer)
value
- the Datelocalizer
- the DataValueLocalizer to usepublic int compareTo(Object o)
Delegates comparison to a comparison of the two names.
compareTo
in interface Comparable
o
- the second DataValue to compare withpublic static int toSqlType(int dataType)
dataType
- the Attribute data typeCopyright © 2023. All rights reserved.