com.googlecode.sarasvati.env
Class AttributeConverters

java.lang.Object
  extended by com.googlecode.sarasvati.env.AttributeConverters

public class AttributeConverters
extends Object

Static utility class for registering and using AttributeConverters. Note that registering converts is NOT thread-safe, and should be done at startup.

Author:
Paul Lorenz

Constructor Summary
AttributeConverters()
           
 
Method Summary
static AttributeConverter getConverterForType(Class<?> type)
           
static String objectToString(Object object)
           
static void setConverterForType(Class<?> type, AttributeConverter converter)
           
static void setDefaultConverter(AttributeConverter converter)
           
static
<T> T
stringToObject(String string, Class<T> type)
           
static
<T> T
stringToObject(String string, Class<T> type, T defaultValue)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AttributeConverters

public AttributeConverters()
Method Detail

objectToString

public static String objectToString(Object object)

stringToObject

public static <T> T stringToObject(String string,
                                   Class<T> type)

stringToObject

public static <T> T stringToObject(String string,
                                   Class<T> type,
                                   T defaultValue)

setDefaultConverter

public static void setDefaultConverter(AttributeConverter converter)

getConverterForType

public static AttributeConverter getConverterForType(Class<?> type)

setConverterForType

public static void setConverterForType(Class<?> type,
                                       AttributeConverter converter)