Package net.sf.basedb.util.jep.convert
Class ConverterFactory
- java.lang.Object
-
- net.sf.basedb.util.jep.convert.ConverterFactory
-
public class ConverterFactory extends Object
KeepJepConversionFunction
objects for converting built-in JEP object to Query APIExpression
orRestriction
objects.- Version:
- 2.4
- Author:
- nicklas
- See Also:
JepConversionFunction
- Last modified
- $Date: 2008-09-11 22:08:14 +0200 (to, 11 sep 2008) $
-
-
Field Summary
Fields Modifier and Type Field Description private static Map<Object,JepConversionFunction<?>>
converters
-
Constructor Summary
Constructors Constructor Description ConverterFactory()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static JepConversionFunction<?>
getConverter(Object o)
Get a converter for the specified built-in JEP object.static JepConversionFunction<?>
getConverterByClass(Object o)
Get a converter for the specified built-in JEP object by checking if a converter has been registered for it's class.static Collection<JepConversionFunction<?>>
getConverters()
Get all registered converters.static void
registerConverter(Object o, JepConversionFunction<?> converter)
Add a converter for a specific object.
-
-
-
Field Detail
-
converters
private static Map<Object,JepConversionFunction<?>> converters
-
-
Method Detail
-
getConverter
public static JepConversionFunction<?> getConverter(Object o)
Get a converter for the specified built-in JEP object.- Parameters:
o
- The object to convert- Returns:
- A
JepConversionFunction
or null if no converter is found
-
getConverterByClass
public static JepConversionFunction<?> getConverterByClass(Object o)
Get a converter for the specified built-in JEP object by checking if a converter has been registered for it's class.- Parameters:
o
- The object to convert- Returns:
- A
JepConversionFunction
or null if no converter is found
-
registerConverter
public static void registerConverter(Object o, JepConversionFunction<?> converter)
Add a converter for a specific object. It can for example, be the class of a JEP function, the symbol for an operator:registerConverter(Add.class, new AddConverter()); registerConverter("==", new EqualsConverter());
- Parameters:
o
- The object defining what the converter can convertconverter
- The converter- Throws:
ItemAlreadyExistsException
- If a converter already exists for the given class
-
getConverters
public static Collection<JepConversionFunction<?>> getConverters()
Get all registered converters.
-
-