com.jalios.jstore
Class StoreUtil

java.lang.Object
  extended by com.jalios.jstore.StoreUtil
All Implemented Interfaces:
StoreConstants

public class StoreUtil
extends Object
implements StoreConstants

This class contains static utility methods

Version:
$Revision: 28198 $
Author:
Olivier Dedieu

Field Summary
static String REVISION
           
 
Fields inherited from interface com.jalios.jstore.StoreConstants
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 Summary
StoreUtil()
           
 
Method Summary
static boolean checkUrid(String urid)
          Checks if the given urid is valid
static ArrayList<?> decodeArrayList(String listStr, Store store)
           
static boolean[] decodeBooleanArray(String arrayStr)
           
static byte[] decodeByteArray(String arrayStr)
           
static char[] decodeCharArray(String arrayStr)
           
static Class<?> decodeClass(String classStr, Store store)
           
static Collection<?> decodeCollection(String collStr, Store store, Collection<Object> coll)
           
static Date decodeDate(String dateStr)
           
static double[] decodeDoubleArray(String arrayStr)
           
static float[] decodeFloatArray(String arrayStr)
           
static HashMap<?,?> decodeHashMap(String mapStr, Store store)
           
static HashSet<?> decodeHashSet(String setStr, Store store)
           
static Hashtable<?,?> decodeHashtable(String mapStr, Store store)
           
static int[] decodeIntArray(String arrayStr)
           
static LinkedHashMap<?,?> decodeLinkedHashMap(String mapStr, Store store)
           
static LinkedList<?> decodeLinkedList(String listStr, Store store)
           
static long[] decodeLongArray(String arrayStr)
           
static Map<?,?> decodeMap(String mapStr, Store store, Map<Object,Object> map)
           
static Object decodeObject(Class<?> clazz, String objStr, Store store)
          Generic object decoder
static Object[] decodeObjectArray(String arrayStr, Class<?> componentType, Store store)
           
static Properties decodeProperties(String propertiesStr)
           
static short[] decodeShortArray(String arrayStr)
           
static Storable decodeStorable(String id, Store store)
           
static TreeMap<?,?> decodeTreeMap(String mapStr, Store store)
           
static TreeSet<?> decodeTreeSet(String setStr, Store store)
           
static Vector<?> decodeVector(String vectorStr, Store store)
           
static String encodeArrayList(ArrayList<?> list, Store store)
           
static String encodeBooleanArray(boolean[] array)
           
static String encodeByteArray(byte[] array)
           
static String encodeCharArray(char[] array)
           
static String encodeClass(Class<?> clazz)
           
static String encodeCollection(Collection<?> coll, Store store)
           
static String encodeDate(Date date)
           
static String encodeDoubleArray(double[] array)
           
static String encodeFloatArray(float[] array)
           
static String encodeHashMap(HashMap<?,?> map, Store store)
           
static String encodeHashSet(HashSet<?> set, Store store)
           
static String encodeHashtable(Hashtable<?,?> map, Store store)
           
static String encodeIntArray(int[] array)
           
static String encodeLinkedHashMap(LinkedHashMap<?,?> map, Store store)
           
static String encodeLinkedList(LinkedList<?> list, Store store)
           
static String encodeLongArray(long[] array)
           
static String encodeMap(Map<?,?> map, Store store)
           
static String encodeObject(Object obj, Store store)
          Generic object encoder
static String encodeObjectArray(Object[] array, Store store)
           
static String encodeProperties(Properties properties)
           
static String encodeShortArray(short[] array)
           
static String encodeStorable(Storable storable, Store store)
           
static String encodeTreeMap(TreeMap<?,?> map, Store store)
           
static String encodeTreeSet(TreeSet<?> set, Store store)
           
static String encodeVector(Vector<?> vector, Store store)
           
static String generateUrid()
          Generates an URID based on the local hostname
static Field getField(Class<?> clazz, String attName)
          Returns a Field object that reflects the specified declared field of the class or interface represented by this Class object.
static Object getFieldValue(Object instance, Field field)
           
static String getGetterMethodName(Field field)
           
static String getSetterMethodName(Field field)
           
static void main(String[] args)
           
static void setFieldValue(Storable storable, Field field, Object fieldValue)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REVISION

public static final String REVISION
See Also:
Constant Field Values
Constructor Detail

StoreUtil

public StoreUtil()
Method Detail

generateUrid

public static String generateUrid()
Generates an URID based on the local hostname

Returns:
the URID
Since:
jcms-4.0.2

checkUrid

public static boolean checkUrid(String urid)
Checks if the given urid is valid

Parameters:
urid - the urid to be checked
Returns:
true if the urid is valid
Since:
jcms-5.0.0

main

public static void main(String[] args)

getGetterMethodName

public static String getGetterMethodName(Field field)
See Also:
ReflectUtil.getGetterMethodName(Field)

getSetterMethodName

public static String getSetterMethodName(Field field)
See Also:
ReflectUtil.getSetterMethodName(Field)

getField

public static Field getField(Class<?> clazz,
                             String attName)
Returns a Field object that reflects the specified declared field of the class or interface represented by this Class object.

Parameters:
clazz - specifies the class or interface
attName - the name of the desired field

getFieldValue

public static Object getFieldValue(Object instance,
                                   Field field)
See Also:
ReflectUtil.getFieldValue(Object, Field)

setFieldValue

public static void setFieldValue(Storable storable,
                                 Field field,
                                 Object fieldValue)
See Also:
ReflectUtil.setFieldValue(Object, Field, Object)

encodeObject

public static String encodeObject(Object obj,
                                  Store store)
Generic object encoder

Parameters:
obj - the object to encode
store - the Store (use to swizzle Storable)
Returns:
a String containing the encoded value of the object. Or null, if decoding failed.

decodeObject

public static Object decodeObject(Class<?> clazz,
                                  String objStr,
                                  Store store)
Generic object decoder

Parameters:
clazz - the object's class to decode
objStr - the encoding representation of the object
store - the Store (use to unswizzle Storable)
Returns:
the object. Or null if decoding failed.

encodeBooleanArray

public static String encodeBooleanArray(boolean[] array)

decodeBooleanArray

public static boolean[] decodeBooleanArray(String arrayStr)

encodeByteArray

public static String encodeByteArray(byte[] array)

decodeByteArray

public static byte[] decodeByteArray(String arrayStr)

encodeCharArray

public static String encodeCharArray(char[] array)

decodeCharArray

public static char[] decodeCharArray(String arrayStr)

encodeDoubleArray

public static String encodeDoubleArray(double[] array)

decodeDoubleArray

public static double[] decodeDoubleArray(String arrayStr)

encodeFloatArray

public static String encodeFloatArray(float[] array)

decodeFloatArray

public static float[] decodeFloatArray(String arrayStr)

encodeIntArray

public static String encodeIntArray(int[] array)

decodeIntArray

public static int[] decodeIntArray(String arrayStr)

encodeLongArray

public static String encodeLongArray(long[] array)

decodeLongArray

public static long[] decodeLongArray(String arrayStr)

encodeShortArray

public static String encodeShortArray(short[] array)

decodeShortArray

public static short[] decodeShortArray(String arrayStr)

encodeObjectArray

public static String encodeObjectArray(Object[] array,
                                       Store store)

decodeObjectArray

public static Object[] decodeObjectArray(String arrayStr,
                                         Class<?> componentType,
                                         Store store)

encodeStorable

public static String encodeStorable(Storable storable,
                                    Store store)

decodeStorable

public static Storable decodeStorable(String id,
                                      Store store)

encodeDate

public static String encodeDate(Date date)

decodeDate

public static Date decodeDate(String dateStr)

encodeClass

public static String encodeClass(Class<?> clazz)

decodeClass

public static Class<?> decodeClass(String classStr,
                                   Store store)

encodeProperties

public static String encodeProperties(Properties properties)

decodeProperties

public static Properties decodeProperties(String propertiesStr)

encodeCollection

public static String encodeCollection(Collection<?> coll,
                                      Store store)

decodeCollection

public static Collection<?> decodeCollection(String collStr,
                                             Store store,
                                             Collection<Object> coll)

encodeArrayList

public static String encodeArrayList(ArrayList<?> list,
                                     Store store)

decodeArrayList

public static ArrayList<?> decodeArrayList(String listStr,
                                           Store store)

encodeLinkedList

public static String encodeLinkedList(LinkedList<?> list,
                                      Store store)

decodeLinkedList

public static LinkedList<?> decodeLinkedList(String listStr,
                                             Store store)

encodeVector

public static String encodeVector(Vector<?> vector,
                                  Store store)

decodeVector

public static Vector<?> decodeVector(String vectorStr,
                                     Store store)

encodeHashSet

public static String encodeHashSet(HashSet<?> set,
                                   Store store)

decodeHashSet

public static HashSet<?> decodeHashSet(String setStr,
                                       Store store)

encodeTreeSet

public static String encodeTreeSet(TreeSet<?> set,
                                   Store store)

decodeTreeSet

public static TreeSet<?> decodeTreeSet(String setStr,
                                       Store store)

encodeMap

public static String encodeMap(Map<?,?> map,
                               Store store)

decodeMap

public static Map<?,?> decodeMap(String mapStr,
                                 Store store,
                                 Map<Object,Object> map)

encodeLinkedHashMap

public static String encodeLinkedHashMap(LinkedHashMap<?,?> map,
                                         Store store)

decodeLinkedHashMap

public static LinkedHashMap<?,?> decodeLinkedHashMap(String mapStr,
                                                     Store store)

encodeHashMap

public static String encodeHashMap(HashMap<?,?> map,
                                   Store store)

decodeHashMap

public static HashMap<?,?> decodeHashMap(String mapStr,
                                         Store store)

encodeHashtable

public static String encodeHashtable(Hashtable<?,?> map,
                                     Store store)

decodeHashtable

public static Hashtable<?,?> decodeHashtable(String mapStr,
                                             Store store)

encodeTreeMap

public static String encodeTreeMap(TreeMap<?,?> map,
                                   Store store)

decodeTreeMap

public static TreeMap<?,?> decodeTreeMap(String mapStr,
                                         Store store)


Copyright © 2001-2010 Jalios SA. All Rights Reserved.