Package de.uplanet.lucy.server.ixvalue
Class IxStringValue
- java.lang.Object
-
- de.uplanet.lucy.server.ixvalue.AbstractIxValue
-
- de.uplanet.lucy.server.ixvalue.IxStringValue
-
- All Implemented Interfaces:
IIxValue
public final class IxStringValue extends AbstractIxValue
-
-
Constructor Summary
Constructors Constructor Description IxStringValue(de.uplanet.lucy.types.UP_TYPE p_stringType, String p_strValue)
IxStringValue(String p_strValue)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BigDecimal
asBigDecimal()
Returns a big decimal value.boolean
asBoolean()
Returns the a boolean value.Date
asDate()
Returns the date value.double
asDouble()
Returns a double value.int
asInt()
Returns a integer value.long
asLong()
Returns a long value.String
asString()
Returns the value as an stringDate
asTime()
Returns the time value.Timestamp
asTimestamp()
Returns a timestamp value.IValueHolder<?>
asValueHolder()
Returns the value as an value holder.String
getValue()
Returns the physical value.boolean
isPrimitive()
Returnstrue
on a primitive value type like integer or boolean.-
Methods inherited from class de.uplanet.lucy.server.ixvalue.AbstractIxValue
asBigDecimal, asBoolean, asDate, asDouble, asInt, asLong, asString, asTime, asTimestamp, getType, hasValue
-
-
-
-
Constructor Detail
-
IxStringValue
public IxStringValue(String p_strValue)
- Parameters:
p_strValue
- The value (could benull
)
-
IxStringValue
public IxStringValue(de.uplanet.lucy.types.UP_TYPE p_stringType, String p_strValue)
- Parameters:
p_stringType
- The string type (notnull
)p_strValue
- The value (could benull
)
-
-
Method Detail
-
getValue
public String getValue()
Description copied from interface:IIxValue
Returns the physical value. Mostly an string value. For normal use cases, please use theIIxValue.asBigDecimal()
IIxValue.asBigDecimal(BigDecimal)
IIxValue.asBoolean()
IIxValue.asBoolean(boolean)
IIxValue.asDate()
IIxValue.asDate(Date)
IIxValue.asDouble()
IIxValue.asDouble(double)
IIxValue.asInt()
IIxValue.asInt(int)
IIxValue.asLong()
IIxValue.asLong(long)
IIxValue.asString()
IIxValue.asString(String)
IIxValue.asTime()
IIxValue.asTime(Date)
IIxValue.asTimestamp()
IIxValue.asTimestamp(Timestamp)
- Returns:
- Returns the value (could be
null
).
-
asValueHolder
public IValueHolder<?> asValueHolder()
Description copied from interface:IIxValue
Returns the value as an value holder.- Returns:
- Converts a IIxValue to an value holder.
-
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.- Specified by:
asString
in interfaceIIxValue
- Overrides:
asString
in classAbstractIxValue
- Returns:
- Returns the value as an string.
-
asBigDecimal
public BigDecimal asBigDecimal()
Description copied from interface:IIxValue
Returns a big decimal value.Cast Rules: String new BigDecimal(value) Numeric Types new BigDecimalvalue)
- Returns:
- Returns the value as an big decimal or null if
IIxValue.hasValue()
==false
.
-
asBoolean
public boolean asBoolean()
Description copied from interface:IIxValue
Returns the a boolean value.Cast Rules: String "0" = false "1" = true "true" = true "false" = false all other values
false
Numeric (int, long, double): 0 = false 1 = true other valuestrue
(value != 0)- Returns:
- Returns the value as an boolean.
-
asDouble
public double asDouble()
Description copied from interface:IIxValue
Returns a double value.Cast Rules: String Double.parseDouble(value) Numeric Types (double)value
- Returns:
- Returns the value as an double.
-
asInt
public int asInt()
Description copied from interface:IIxValue
Returns a integer value.Cast Rules: String Integer.parseInteger(value) Numeric Types (int)value
- Returns:
- Returns the value as an integer.
-
asLong
public long asLong()
Description copied from interface:IIxValue
Returns a long value.Cast Rules: String Long.parseLong(value) Numeric Types (long)value
- Returns:
- Returns the value as an long.
Throws an exception if
IIxValue.hasValue()
==false
or the value type cannot be casted to an long.
-
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
- Overrides:
asTimestamp
in classAbstractIxValue
- Returns:
- Returns the value as an timestamp.
-
asDate
public Date asDate()
Description copied from interface:IIxValue
Returns the date value.Value must be a date / time stamp / string type.
- Specified by:
asDate
in interfaceIIxValue
- Overrides:
asDate
in classAbstractIxValue
- 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.
- Specified by:
asTime
in interfaceIIxValue
- Overrides:
asTime
in classAbstractIxValue
- Returns:
- Returns the value as an time.
-
isPrimitive
public boolean isPrimitive()
Description copied from interface:IIxValue
Returnstrue
on a primitive value type like integer or boolean.- Returns:
- Returns
true
if the value represent an primitive type like a boolean, integer...
-
-