Package de.xima.fc.form.common.models
Class XPropertyValue
- java.lang.Object
-
- de.xima.fc.form.common.models.XPropertyValue
-
- All Implemented Interfaces:
Serializable
public class XPropertyValue extends Object implements Serializable
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description XPropertyValue(XPropertyEnum xProperty, Object value)
XPropertyValue(String xPropertyName, Object value)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected XPropertyValue
clone()
boolean
equals(Object o)
Object
get()
Boolean
getBoolean()
Character
getChar()
Returns the first character of the value as a char.boolean
getDefaultBoolean()
boolean
getDefaultBoolean(boolean defaultValue)
char
getDefaultChar(char defaultValue)
Returns the first character of the value as a char.double
getDefaultDouble()
double
getDefaultDouble(double defaultValue)
<E extends Enum<E>>
EgetDefaultEnum(Class<E> enumClass, E defaultValue)
Reads the value as a string and tries to parse it as an enum.<E extends Enum<E>>
EgetDefaultEnum(Function<String,E> enumParser, E defaultValue)
Reads the value as a string and tries to parse it as an enum.int
getDefaultInt()
int
getDefaultInt(int defaultValue)
com.alibaba.fastjson.JSONArray
getDefaultJSONArray()
com.alibaba.fastjson.JSONObject
getDefaultJSONObject()
long
getDefaultLong(long defaultValue)
Returns the value as a long.String
getDefaultString()
Similar togetString()
, but returns an empty string if the value is null.String
getDefaultString(String defaultValue)
Similar togetString()
, but returns the default value if the value is null.String
getDefaultStringIfBlank(String defaultValue)
Similar togetString()
, but returns the default value if the value is null or blank.String
getDefaultStringIfEmpty(String defaultValue)
Similar togetString()
, but returns the default value if the value is null or empty.Double
getDouble()
<E extends Enum<E>>
EgetEnum(Class<E> enumClass)
Reads the value as a string and tries to parse it as an enum.<E extends Enum<E>>
EgetEnum(Function<String,E> enumParser)
Reads the value as a string and tries to parse it as an enum.Integer
getInt()
com.alibaba.fastjson.JSONArray
getJSONArray()
com.alibaba.fastjson.JSONObject
getJSONObject()
Long
getLong()
String
getPropertyName()
String
getString()
UUID
getUUID()
XPropertyEnum
getXPropertyEnum()
int
hashCode()
void
setValue(Object value)
-
-
-
Constructor Detail
-
XPropertyValue
public XPropertyValue(XPropertyEnum xProperty, Object value)
-
-
Method Detail
-
getXPropertyEnum
public XPropertyEnum getXPropertyEnum()
-
getPropertyName
public String getPropertyName()
-
get
public Object get()
-
getInt
public Integer getInt()
-
getLong
public Long getLong()
-
getDouble
public Double getDouble()
-
getString
public String getString()
-
getUUID
public UUID getUUID()
-
getBoolean
public Boolean getBoolean()
-
getJSONArray
public com.alibaba.fastjson.JSONArray getJSONArray()
-
getJSONObject
public com.alibaba.fastjson.JSONObject getJSONObject()
-
setValue
public void setValue(Object value)
-
clone
protected XPropertyValue clone()
-
getDefaultBoolean
public boolean getDefaultBoolean()
-
getDefaultBoolean
public boolean getDefaultBoolean(boolean defaultValue)
-
getDefaultLong
public long getDefaultLong(long defaultValue)
Returns the value as a long. If the value is null or cannot be parsed as a long, returns the default value.- Returns:
- The value as a long, or the default value if the value is null or cannot be parsed as a long.
-
getChar
public Character getChar()
Returns the first character of the value as a char. If the value is null or empty, returns null.- Returns:
- The first character of the value as a char, or null if the value is null or empty.
-
getDefaultChar
public char getDefaultChar(char defaultValue)
Returns the first character of the value as a char. If the value is null or empty, returns the default value.- Parameters:
defaultValue
- The default value to return if the value is null or empty.- Returns:
- The first character of the value as a char, or the default value if the value is null or empty.
-
getEnum
public <E extends Enum<E>> E getEnum(Class<E> enumClass)
Reads the value as a string and tries to parse it as an enum. If the value is null or cannot be parsed as an enum, returns null.- Type Parameters:
E
- The enum type.- Parameters:
enumClass
- The enum class to parse the value as.- Returns:
- The value as an enum, or the default value if the value is null or cannot be parsed as an enum.
-
getEnum
public <E extends Enum<E>> E getEnum(Function<String,E> enumParser)
Reads the value as a string and tries to parse it as an enum. If the value is null or cannot be parsed as an enum, returns null.- Type Parameters:
E
- The enum type.- Parameters:
enumParser
- Parser for obtaining the enum from the string.- Returns:
- The value as an enum, or the default value if the value is null or cannot be parsed as an enum.
-
getDefaultEnum
public <E extends Enum<E>> E getDefaultEnum(Class<E> enumClass, E defaultValue)
Reads the value as a string and tries to parse it as an enum. If the value is null or cannot be parsed as an enum, the default value is returned.- Type Parameters:
E
- The enum type.- Parameters:
enumClass
- The enum class to parse the value as.defaultValue
- The default value to return if the value is null or cannot be parsed as an enum.- Returns:
- The value as an enum, or the default value if the value is null or cannot be parsed as an enum.
-
getDefaultEnum
public <E extends Enum<E>> E getDefaultEnum(Function<String,E> enumParser, E defaultValue)
Reads the value as a string and tries to parse it as an enum. If the value is null or cannot be parsed as an enum, the default value is returned.- Type Parameters:
E
- The enum type.- Parameters:
enumParser
- Parser for obtaining the enum from the string.defaultValue
- The default value to return if the value is null or cannot be parsed as an enum.- Returns:
- The value as an enum, or the default value if the value is null or cannot be parsed as an enum.
-
getDefaultString
public String getDefaultString()
Similar togetString()
, but returns an empty string if the value is null.- Returns:
- The value as a string, or an empty string if the value is null.
-
getDefaultString
public String getDefaultString(String defaultValue)
Similar togetString()
, but returns the default value if the value is null.- Parameters:
defaultValue
- The default value to return if the value is null.- Returns:
- The value as a string, or the default value if the value is null.
-
getDefaultStringIfEmpty
public String getDefaultStringIfEmpty(String defaultValue)
Similar togetString()
, but returns the default value if the value is null or empty.- Parameters:
defaultValue
- The default value to return if the value is null or empty.- Returns:
- The value as a string, or the default value if the value is null or empty.
-
getDefaultStringIfBlank
public String getDefaultStringIfBlank(String defaultValue)
Similar togetString()
, but returns the default value if the value is null or blank.- Parameters:
defaultValue
- The default value to return if the value is null or blank.- Returns:
- The value as a string, or the default value if the value is null or blank.
-
getDefaultInt
public int getDefaultInt()
-
getDefaultInt
public int getDefaultInt(int defaultValue)
-
getDefaultDouble
public double getDefaultDouble()
-
getDefaultDouble
public double getDefaultDouble(double defaultValue)
-
getDefaultJSONArray
public com.alibaba.fastjson.JSONArray getDefaultJSONArray()
-
getDefaultJSONObject
public com.alibaba.fastjson.JSONObject getDefaultJSONObject()
-
-