Package de.uplanet.lucy.server.ixvalue
Class AbstractIxValue
- java.lang.Object
-
- de.uplanet.lucy.server.ixvalue.AbstractIxValue
-
- All Implemented Interfaces:
IIxValue
- Direct Known Subclasses:
IxBigDecimalValue
,IxBooleanValue
,IxDateTimeValue
,IxDoubleValue
,IxIntValue
,IxLongValue
,IxObjectValue
,IxStringValue
public abstract class AbstractIxValue extends Object implements IIxValue
-
-
Constructor Summary
Constructors Constructor Description AbstractIxValue(de.uplanet.lucy.types.UP_TYPE p_type, Object p_value)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BigDecimal
asBigDecimal(BigDecimal p_fallbackValue)
Returns a big decimal value or the fallback value on an empty value.boolean
asBoolean(boolean p_bFallbackValue)
Returns the boolean value or the fallback value on an empty value.Date
asDate()
Returns the date value.Date
asDate(Date p_fallbackValue)
Returns the date value or the fallback date for an empty value.double
asDouble(double p_dFallbackValue)
Returns the value as an double or the fallback value on an empty value.int
asInt(int p_iFallbackValue)
Returns a integer value or the fallback value on an empty value.long
asLong(long p_lFallbackValue)
Returns a long value or the fallback value on an empty value.String
asString()
Returns the value as an stringString
asString(String p_strFallback)
Returns the value as an stringDate
asTime()
Returns the time value.Date
asTime(Date p_fallbackValue)
Returns the time value or the fallback value on an empty value.Timestamp
asTimestamp()
Returns a timestamp value.Timestamp
asTimestamp(Timestamp p_fallbackValue)
Returns the timestamp value or the given fallback value for an empty value.de.uplanet.lucy.types.UP_TYPE
getType()
Returns the type.boolean
hasValue()
Returnstrue
if the value is not empty or exits.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.uplanet.lucy.server.ixvalue.IIxValue
asBigDecimal, asBoolean, asDouble, asInt, asLong, asValueHolder, getValue, isPrimitive
-
-
-
-
Constructor Detail
-
AbstractIxValue
public AbstractIxValue(de.uplanet.lucy.types.UP_TYPE p_type, Object p_value)
- Parameters:
p_type
- The type (notnull
)p_value
- The value (could benull
)
-
-
Method Detail
-
getType
public de.uplanet.lucy.types.UP_TYPE getType()
Description copied from interface:IIxValue
Returns the type. For internal use only.
-
asString
public String asString()
Description copied from interface:IIxValue
Returns the value as an stringCast Rules: Date values: A string representation of the date in the
yyyy-MM-dd HH:mm:ss
format, calculated for the TimeZone UTC. Other Types: String.valueOf(type) will returned.
-
asString
public final String asString(String p_strFallback)
Description copied from interface:IIxValue
Returns the value as an stringCast Rules: Date values: A string representation of the date in the
yyyy-MM-dd HH:mm:ss
format, calculated for the TimeZone UTC. Other Types: String.valueOf(type) will returned.- Specified by:
asString
in interfaceIIxValue
- Parameters:
p_strFallback
- The fallback value used ifIIxValue.hasValue()
==false
.- Returns:
- Returns the value as an string or p_strFallbackValue if
IIxValue.hasValue()
==false
.
-
asBoolean
public final boolean asBoolean(boolean p_bFallbackValue)
Description copied from interface:IIxValue
Returns the boolean value or the fallback value on an empty value.Cast Rules: String "0" = false "1" = true "true" = true "false" = false all other values
false
Numeric (int, long, double): 0 = false 1 = true all other valuestrue
(value != 0)- Specified by:
asBoolean
in interfaceIIxValue
- Parameters:
p_bFallbackValue
- The fallback value used ifIIxValue.hasValue()
==false
.- Returns:
- Returns the value as an boolean or the given fallback value if
IIxValue.hasValue()
==false
.
-
asBigDecimal
public final BigDecimal asBigDecimal(BigDecimal p_fallbackValue)
Description copied from interface:IIxValue
Returns a big decimal value or the fallback value on an empty value.Cast Rules: String new BigDecimal(value) Numeric Types new BigDecimalvalue)
- Specified by:
asBigDecimal
in interfaceIIxValue
- Parameters:
p_fallbackValue
- The fallback value used ifIIxValue.hasValue()
==false
.- Returns:
- Returns the value as an string or p_fallbackValue if
IIxValue.hasValue()
==false
.
-
asDouble
public final double asDouble(double p_dFallbackValue)
Description copied from interface:IIxValue
Returns the value as an double or the fallback value on an empty value.Cast Rules: String Double.parseDouble(value) Numeric: (double)value
- Specified by:
asDouble
in interfaceIIxValue
- Parameters:
p_dFallbackValue
- The fallback value used ifIIxValue.hasValue()
==false
.- Returns:
- Returns the value as an double or the fallback value if
IIxValue.hasValue()
==false
.
-
asInt
public final int asInt(int p_iFallbackValue)
Description copied from interface:IIxValue
Returns a integer value or the fallback value on an empty value.Cast Rules: String Integer.parseInteger(value) Numeric Types (int)value Other types: String.valueOf(type) will check.
- Specified by:
asInt
in interfaceIIxValue
- Parameters:
p_iFallbackValue
- The fallback value used ifIIxValue.hasValue()
==false
.- Returns:
- Returns the value as an integer or p_iFallbackValue if
IIxValue.hasValue()
==false
-
asLong
public final long asLong(long p_lFallbackValue)
Description copied from interface:IIxValue
Returns a long value or the fallback value on an empty value.Cast Rules: String Long.parseLong(value) Numeric Types (long)value Other types: String.valueOf(type) will check.
- Specified by:
asLong
in interfaceIIxValue
- Parameters:
p_lFallbackValue
- The fallback value used ifIIxValue.hasValue()
==false
.- Returns:
- Returns the value as an long or p_lFallbackValue if
IIxValue.hasValue()
==false
.
-
hasValue
public final boolean hasValue()
Description copied from interface:IIxValue
Returnstrue
if the value is not empty or exits.- Specified by:
hasValue
in interfaceIIxValue
- Returns:
- Returns
true
ifIIxValue.getValue()
!= null otherwisefalse
will returned.
-
asDate
public Date asDate()
Description copied from interface:IIxValue
Returns the date value.Value must be a date / time stamp / string type.
-
asDate
public final Date asDate(Date p_fallbackValue)
Description copied from interface:IIxValue
Returns the date value or the fallback date for an empty value.Value must be a date / time stamp / string type.
- Specified by:
asDate
in interfaceIIxValue
- Parameters:
p_fallbackValue
- The fallback value used ifIIxValue.hasValue()
==false
.- Returns:
- Returns the value as an date.
-
asTime
public Date asTime()
Description copied from interface:IIxValue
Returns the time value.Value must be a time / time stamp / string type.
-
asTime
public final Date asTime(Date p_fallbackValue)
Description copied from interface:IIxValue
Returns the time value or the fallback value on an empty value.Value must be a time / time stamp / string type.
-
asTimestamp
public Timestamp asTimestamp()
Description copied from interface:IIxValue
Returns a timestamp value.Value must be a date / timestamp type. No cast will be done.
- Specified by:
asTimestamp
in interfaceIIxValue
- Returns:
- Returns the value as an timestamp.
-
asTimestamp
public final Timestamp asTimestamp(Timestamp p_fallbackValue)
Description copied from interface:IIxValue
Returns the timestamp value or the given fallback value for an empty value.Value must be a date / timestamp type. No cast will be done.
- Specified by:
asTimestamp
in interfaceIIxValue
- Parameters:
p_fallbackValue
- The fallback value used ifIIxValue.hasValue()
==false
.- Returns:
- Returns the value as an timestamp.
-
-