public class ValueObject extends Object implements Serializable
A ValueObject
encapsulate data of simple types in common Java application.
Simple type here refers to
ValueObject.Codec
registered
ValueObject
is immutable
Modifier and Type | Class and Description |
---|---|
static interface |
ValueObject.Codec<T> |
Constructor and Description |
---|
ValueObject() |
ValueObject(boolean b) |
ValueObject(byte b) |
ValueObject(char c) |
ValueObject(CharSequence s) |
ValueObject(double d) |
ValueObject(Enum e) |
ValueObject(float f) |
ValueObject(int i) |
ValueObject(long l) |
ValueObject(Object o) |
ValueObject(short s) |
ValueObject(String s) |
ValueObject(ValueObject copy) |
Modifier and Type | Method and Description |
---|---|
boolean |
booleanValue() |
byte |
byteValue() |
char |
charValue() |
static <T> T |
decode(String string,
Class<T> targetType)
Decode a object instance from a string with given target object type
|
double |
doubleValue() |
static String |
encode(Object o)
Encode a object into a String
|
<T extends Enum> |
enumValue() |
boolean |
equals(Object obj) |
float |
floatValue() |
int |
hashCode() |
int |
intValue() |
boolean |
isUDF() |
long |
longValue() |
static ValueObject |
of(Object o) |
static void |
register(ValueObject.Codec codec) |
short |
shortValue() |
String |
stringValue() |
String |
toJSONString() |
String |
toString() |
static void |
unregister(ValueObject.Codec codec) |
<T> T |
value() |
public ValueObject()
public ValueObject(boolean b)
public ValueObject(byte b)
public ValueObject(char c)
public ValueObject(short s)
public ValueObject(int i)
public ValueObject(float f)
public ValueObject(long l)
public ValueObject(double d)
public ValueObject(String s)
public ValueObject(CharSequence s)
public ValueObject(Enum e)
public ValueObject(Object o)
public ValueObject(ValueObject copy)
public boolean booleanValue()
public byte byteValue()
public char charValue()
public short shortValue()
public int intValue()
public float floatValue()
public long longValue()
public double doubleValue()
public String stringValue()
public <T extends Enum> T enumValue()
public <T> T value()
public boolean isUDF()
public String toJSONString()
public static void register(ValueObject.Codec codec)
public static void unregister(ValueObject.Codec codec)
public static <T> T decode(String string, Class<T> targetType)
Decode a object instance from a string with given target object type
T
- the generic type of the instancestring
- the string encoded the value of the instancetargetType
- the class of the instance decoded from the stringpublic static String encode(Object o)
Encode a object into a String
o
- the object to be encodedIllegalArgumentException
- when object is a UDF type and Codec is not registeredpublic static ValueObject of(Object o)
Copyright © 2014–2018 OSGL (Open Source General Library). All rights reserved.