public class StoreUtil extends java.lang.Object implements StoreConstants
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
REVISION |
ARRAY_FLAG, CLEANING_STATE, COLLECTION_FLAG, CREATE_OP, DELETE_OP, IDLE_STATE, INNER_LOGS, INNER_MILESTONE, INNER_PREFIX, INNER_SYNC, ITEM_ESCAPE_CHAR, ITEM_SEPARATOR, LOADING_STATE, MAP_ASSIGN, MAP_CHARS_TO_ESCAPE, MAP_CLASS_SEPARATOR, MAP_FLAG, NAMESPACE, SH_SUFFIX, STORING_STATE, UPDATE_OP
Constructor and Description |
---|
StoreUtil() |
Modifier and Type | Method and Description |
---|---|
static boolean |
checkUrid(java.lang.String urid)
Checks if the given urid is valid
|
static java.util.ArrayList<?> |
decodeArrayList(java.lang.String listStr,
Store store,
DecodeContext ctxt) |
static boolean[] |
decodeBooleanArray(java.lang.String arrayStr) |
static byte[] |
decodeByteArray(java.lang.String arrayStr) |
static char[] |
decodeCharArray(java.lang.String arrayStr) |
static java.lang.Class<?> |
decodeClass(java.lang.String classStr,
Store store) |
static java.util.Collection<?> |
decodeCollection(java.lang.String collStr,
Store store,
java.util.Collection<java.lang.Object> coll,
DecodeContext ctxt) |
static java.util.Date |
decodeDate(java.lang.String dateStr) |
static double[] |
decodeDoubleArray(java.lang.String arrayStr) |
static float[] |
decodeFloatArray(java.lang.String arrayStr) |
static java.util.HashMap<?,?> |
decodeHashMap(java.lang.String mapStr,
Store store,
DecodeContext ctxt) |
static java.util.HashSet<?> |
decodeHashSet(java.lang.String setStr,
Store store,
DecodeContext ctxt) |
static java.util.Hashtable<?,?> |
decodeHashtable(java.lang.String mapStr,
Store store,
DecodeContext ctxt) |
static int[] |
decodeIntArray(java.lang.String arrayStr) |
static java.util.LinkedHashMap<?,?> |
decodeLinkedHashMap(java.lang.String mapStr,
Store store,
DecodeContext ctxt) |
static java.util.LinkedList<?> |
decodeLinkedList(java.lang.String listStr,
Store store,
DecodeContext ctxt) |
static long[] |
decodeLongArray(java.lang.String arrayStr) |
static java.util.Map<?,?> |
decodeMap(java.lang.String mapStr,
Store store,
java.util.Map<java.lang.Object,java.lang.Object> map,
DecodeContext ctxt) |
static java.lang.Object |
decodeObject(java.lang.Class<?> clazz,
java.lang.String objStr,
Store store,
DecodeContext ctxt)
Generic object decoder
|
static java.lang.Object[] |
decodeObjectArray(java.lang.String arrayStr,
java.lang.Class<?> componentType,
Store store) |
static java.lang.Object[] |
decodeObjectArray(java.lang.String arrayStr,
java.lang.Class<?> componentType,
Store store,
DecodeContext ctxt) |
static java.util.Properties |
decodeProperties(java.lang.String propertiesStr,
DecodeContext ctxt) |
static short[] |
decodeShortArray(java.lang.String arrayStr) |
static Storable |
decodeStorable(java.lang.String id,
Store store) |
static java.util.TreeMap<?,?> |
decodeTreeMap(java.lang.String mapStr,
Store store,
DecodeContext ctxt) |
static java.util.TreeSet<?> |
decodeTreeSet(java.lang.String setStr,
Store store,
DecodeContext ctxt) |
static java.util.Vector<?> |
decodeVector(java.lang.String vectorStr,
Store store,
DecodeContext ctxt) |
static java.lang.String |
encodeArrayList(java.util.ArrayList<?> list,
Store store) |
static java.lang.String |
encodeBooleanArray(boolean[] array) |
static java.lang.String |
encodeByteArray(byte[] array) |
static java.lang.String |
encodeCharArray(char[] array) |
static java.lang.String |
encodeClass(java.lang.Class<?> clazz) |
static java.lang.String |
encodeCollection(java.util.Collection<?> coll,
Store store) |
static java.lang.String |
encodeDate(java.util.Date date) |
static java.lang.String |
encodeDoubleArray(double[] array) |
static java.lang.String |
encodeFloatArray(float[] array) |
static java.lang.String |
encodeHashMap(java.util.HashMap<?,?> map,
Store store) |
static java.lang.String |
encodeHashSet(java.util.HashSet<?> set,
Store store) |
static java.lang.String |
encodeHashtable(java.util.Hashtable<?,?> map,
Store store) |
static java.lang.String |
encodeIntArray(int[] array) |
static java.lang.String |
encodeLinkedHashMap(java.util.LinkedHashMap<?,?> map,
Store store) |
static java.lang.String |
encodeLinkedList(java.util.LinkedList<?> list,
Store store) |
static java.lang.String |
encodeLongArray(long[] array) |
static java.lang.String |
encodeMap(java.util.Map<?,?> map,
Store store) |
static java.lang.String |
encodeObject(java.lang.Object obj,
Store store)
Generic object encoder
|
static java.lang.String |
encodeObjectArray(java.lang.Object[] array,
Store store) |
static java.lang.String |
encodeProperties(java.util.Properties properties) |
static java.lang.String |
encodeShortArray(short[] array) |
static java.lang.String |
encodeStorable(Storable storable,
Store store) |
static java.lang.String |
encodeTreeMap(java.util.TreeMap<?,?> map,
Store store) |
static java.lang.String |
encodeTreeSet(java.util.TreeSet<?> set,
Store store) |
static java.lang.String |
encodeVector(java.util.Vector<?> vector,
Store store) |
static java.lang.String |
generateUrid()
Generates an URID based on the local hostname
|
static java.lang.reflect.Field |
getField(java.lang.Class<?> clazz,
java.lang.String attName)
Returns a Field object that reflects the specified declared
field of the class or interface represented by this Class object.
|
static java.lang.Object |
getFieldValue(java.lang.Object instance,
java.lang.reflect.Field field) |
static java.lang.String |
getGetterMethodName(java.lang.reflect.Field field) |
static java.lang.String |
getSetterMethodName(java.lang.reflect.Field field) |
static boolean |
isArray(java.lang.String value)
Returns true if this value is an array.
|
static boolean |
isArrayOrCollection(java.lang.String value)
Returns true if this value is an array or a collection.
|
static boolean |
isCollection(java.lang.String value)
Returns true if this value is a collection.
|
static boolean |
isMap(java.lang.String value)
Returns true if this value is a map.
|
static void |
main(java.lang.String[] args) |
static void |
setFieldValue(Storable storable,
java.lang.reflect.Field field,
java.lang.Object fieldValue) |
public static final java.lang.String REVISION
public static java.lang.String generateUrid()
public static boolean checkUrid(java.lang.String urid)
urid
- the urid to be checkedpublic static void main(java.lang.String[] args)
public static java.lang.String getGetterMethodName(java.lang.reflect.Field field)
public static java.lang.String getSetterMethodName(java.lang.reflect.Field field)
public static java.lang.reflect.Field getField(java.lang.Class<?> clazz, java.lang.String attName)
clazz
- specifies the class or interfaceattName
- the name of the desired fieldpublic static java.lang.Object getFieldValue(java.lang.Object instance, java.lang.reflect.Field field)
public static void setFieldValue(Storable storable, java.lang.reflect.Field field, java.lang.Object fieldValue)
public static java.lang.String encodeObject(java.lang.Object obj, Store store)
obj
- the object to encodestore
- the Store (use to swizzle Storable)public static java.lang.Object decodeObject(java.lang.Class<?> clazz, java.lang.String objStr, Store store, DecodeContext ctxt)
clazz
- the object's class to decodeobjStr
- the encoding representation of the objectstore
- the Store (use to unswizzle Storable)ctxt
- the DecodeContext (use to have more information when reporting error)public static java.lang.String encodeBooleanArray(boolean[] array)
public static boolean[] decodeBooleanArray(java.lang.String arrayStr)
public static java.lang.String encodeByteArray(byte[] array)
public static byte[] decodeByteArray(java.lang.String arrayStr)
public static java.lang.String encodeCharArray(char[] array)
public static char[] decodeCharArray(java.lang.String arrayStr)
public static java.lang.String encodeDoubleArray(double[] array)
public static double[] decodeDoubleArray(java.lang.String arrayStr)
public static java.lang.String encodeFloatArray(float[] array)
public static float[] decodeFloatArray(java.lang.String arrayStr)
public static java.lang.String encodeIntArray(int[] array)
public static int[] decodeIntArray(java.lang.String arrayStr)
public static java.lang.String encodeLongArray(long[] array)
public static long[] decodeLongArray(java.lang.String arrayStr)
public static java.lang.String encodeShortArray(short[] array)
public static short[] decodeShortArray(java.lang.String arrayStr)
public static java.lang.String encodeObjectArray(java.lang.Object[] array, Store store)
public static java.lang.Object[] decodeObjectArray(java.lang.String arrayStr, java.lang.Class<?> componentType, Store store)
public static java.lang.Object[] decodeObjectArray(java.lang.String arrayStr, java.lang.Class<?> componentType, Store store, DecodeContext ctxt)
public static java.lang.String encodeDate(java.util.Date date)
public static java.util.Date decodeDate(java.lang.String dateStr)
public static java.lang.String encodeClass(java.lang.Class<?> clazz)
public static java.lang.Class<?> decodeClass(java.lang.String classStr, Store store)
public static java.lang.String encodeProperties(java.util.Properties properties)
public static java.util.Properties decodeProperties(java.lang.String propertiesStr, DecodeContext ctxt)
public static java.lang.String encodeCollection(java.util.Collection<?> coll, Store store)
public static java.util.Collection<?> decodeCollection(java.lang.String collStr, Store store, java.util.Collection<java.lang.Object> coll, DecodeContext ctxt)
public static java.lang.String encodeArrayList(java.util.ArrayList<?> list, Store store)
public static java.util.ArrayList<?> decodeArrayList(java.lang.String listStr, Store store, DecodeContext ctxt)
public static java.lang.String encodeLinkedList(java.util.LinkedList<?> list, Store store)
public static java.util.LinkedList<?> decodeLinkedList(java.lang.String listStr, Store store, DecodeContext ctxt)
public static java.lang.String encodeVector(java.util.Vector<?> vector, Store store)
public static java.util.Vector<?> decodeVector(java.lang.String vectorStr, Store store, DecodeContext ctxt)
public static java.lang.String encodeHashSet(java.util.HashSet<?> set, Store store)
public static java.util.HashSet<?> decodeHashSet(java.lang.String setStr, Store store, DecodeContext ctxt)
public static java.lang.String encodeTreeSet(java.util.TreeSet<?> set, Store store)
public static java.util.TreeSet<?> decodeTreeSet(java.lang.String setStr, Store store, DecodeContext ctxt)
public static java.lang.String encodeMap(java.util.Map<?,?> map, Store store)
public static java.util.Map<?,?> decodeMap(java.lang.String mapStr, Store store, java.util.Map<java.lang.Object,java.lang.Object> map, DecodeContext ctxt)
public static java.lang.String encodeLinkedHashMap(java.util.LinkedHashMap<?,?> map, Store store)
public static java.util.LinkedHashMap<?,?> decodeLinkedHashMap(java.lang.String mapStr, Store store, DecodeContext ctxt)
public static java.lang.String encodeHashMap(java.util.HashMap<?,?> map, Store store)
public static java.util.HashMap<?,?> decodeHashMap(java.lang.String mapStr, Store store, DecodeContext ctxt)
public static java.lang.String encodeHashtable(java.util.Hashtable<?,?> map, Store store)
public static java.util.Hashtable<?,?> decodeHashtable(java.lang.String mapStr, Store store, DecodeContext ctxt)
public static java.lang.String encodeTreeMap(java.util.TreeMap<?,?> map, Store store)
public static java.util.TreeMap<?,?> decodeTreeMap(java.lang.String mapStr, Store store, DecodeContext ctxt)
public static boolean isArray(java.lang.String value)
value
- the encoded value.public static boolean isCollection(java.lang.String value)
value
- the encoded value.public static boolean isArrayOrCollection(java.lang.String value)
value
- the encoded value.public static boolean isMap(java.lang.String value)
value
- the encoded value.Copyright © 2001-2010 Jalios SA. All Rights Reserved.