2.17.2: 2011-06-17

net.sf.basedb.util.jep.convert
Class ConverterFactory

java.lang.Object
  extended by net.sf.basedb.util.jep.convert.ConverterFactory

public class ConverterFactory
extends Object

Keep JepConversionFunction objects for converting built-in JEP object to Query API Expression or Restriction objects.

Version:
2.4
Author:
nicklas
See Also:
JepConversionFunction
Last modified
$Date: 2008-09-11 22:08:14 +0200 (Thu, 11 Sep 2008) $

Field Summary
private static Map<Object,JepConversionFunction<?>> converters
           
 
Constructor Summary
ConverterFactory()
           
 
Method Summary
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

converters

private static Map<Object,JepConversionFunction<?>> converters
Constructor Detail

ConverterFactory

public ConverterFactory()
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 convert
converter - The converter
Throws:
ItemAlreadyExistsException - If a converter already exists for the given class

getConverters

public static Collection<JepConversionFunction<?>> getConverters()
Get all registered converters.


2.17.2: 2011-06-17