Package jasima.core.util.converter
Class TypeToStringConverter
- java.lang.Object
-
- jasima.core.util.converter.TypeToStringConverter
-
- Direct Known Subclasses:
TypeConverterBasicTypes,TypeConverterDateTime,TypeConverterDblStream,TypeConverterJavaBean,TypeToStringConverterGenericList
public abstract class TypeToStringConverter extends Object
-
-
Constructor Summary
Constructors Constructor Description TypeToStringConverter()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static <T> TconvertFromString(ArgListTokenizer tk, Class<T> requiredType, String context, ClassLoader loader, String[] packageSearchPath)This method is used internally to create an object as specified by the given parse tree.static <T> TconvertFromString(String s, Class<T> requiredType, String context, ClassLoader loader, String[] packageSearchPath)* Constructs a new ListTokenizer aroundsand then callsconvertFromString(ArgListTokenizer, Class, String, ClassLoader, String[]).static StringconvertToString(Object o)abstract <T> TfromString(ArgListTokenizer tk, Class<T> requiredType, String context, ClassLoader loader, String[] packageSearchPath)abstract Class<?>[]handledTypes()static TypeToStringConverterlookupConverter(Class<?> requiredType)Returns the most specific converter responsible for a certain type.static voidregisterConverter(TypeToStringConverter fact)StringtoString(Object o)
-
-
-
Method Detail
-
handledTypes
public abstract Class<?>[] handledTypes()
-
fromString
public abstract <T> T fromString(ArgListTokenizer tk, Class<T> requiredType, String context, ClassLoader loader, String[] packageSearchPath)
-
registerConverter
public static void registerConverter(TypeToStringConverter fact)
-
convertFromString
public static <T> T convertFromString(String s, Class<T> requiredType, String context, ClassLoader loader, String[] packageSearchPath)
* Constructs a new ListTokenizer aroundsand then callsconvertFromString(ArgListTokenizer, Class, String, ClassLoader, String[]). This class assumes it can read and parse the whole string, otherwise it throws aArgListTokenizer.ParseException.- Type Parameters:
T- The required type.- Parameters:
s- The String value to convert.requiredType- The type it should be converted to.context- An optional property path.loader- The class loader to use.packageSearchPath- Search path to resolve abbreviated class names.- Returns:
sconverted to the required type.
-
convertFromString
public static <T> T convertFromString(ArgListTokenizer tk, Class<T> requiredType, String context, ClassLoader loader, String[] packageSearchPath)
This method is used internally to create an object as specified by the given parse tree.- Type Parameters:
T- Type of returned object.- Parameters:
tk- TheArgListTokenizerused to split the input String in its parts.requiredType- Type the converted parse tree should be compatible with.context- Optional property context path.loader- The classloader to use.packageSearchPath- The package search path.- Returns:
- The object as specified in the parse tree.
-
lookupConverter
public static TypeToStringConverter lookupConverter(Class<?> requiredType)
Returns the most specific converter responsible for a certain type.- Parameters:
requiredType- The required class or interface.- Returns:
- the converter for this
requiredType - See Also:
TypeUtil.computeClasses(Class)
-
-