/** * Encode a object into a String * * @param o the object to be encoded * @return the encoded string representation of the object * @throws IllegalArgumentException when object is a UDF type and Codec is not registered */ public static String encode(Object o) { Type type = typeOf(o); return type.encode(o); }
/** * Decode a object instance from a string with given target object type * * @param string the string encoded the value of the instance * @param targetType the class of the instance decoded from the string * @param <T> the generic type of the instance * @return the instance decoded */ public static <T> T decode(String string, Class<T> targetType) { Type type = typeOf(targetType); return type.decode(string, targetType); }
/** * Encode a object into a String * * @param o the object to be encoded * @return the encoded string representation of the object * @throws IllegalArgumentException when object is a UDF type and Codec is not registered */ public static String encode(Object o) { Type type = typeOf(o); return type.encode(o); }
/** * Decode a object instance from a string with given target object type * * @param string the string encoded the value of the instance * @param targetType the class of the instance decoded from the string * @param <T> the generic type of the instance * @return the instance decoded */ public static <T> T decode(String string, Class<T> targetType) { Type type = typeOf(targetType); return type.decode(string, targetType); }
public ValueObject(Object o) { if (o instanceof ValueObject) { ValueObject that = (ValueObject) o; type = that.type(); type.set(that.value(), this); } else { type = typeOf(o); type.set(o, this); } }
public ValueObject(Object o) { if (o instanceof ValueObject) { ValueObject that = (ValueObject) o; type = that.type(); type.set(that.value(), this); } else { type = typeOf(o); type.set(o, this); } }