Class ConverterFactory

java.lang.Object
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:
Last modified
$Date: 2008-09-11 22:08:14 +0200 (to, 11 sep 2008) $
  • Field Details

  • Constructor Details

    • ConverterFactory

      public ConverterFactory()
  • Method Details

    • 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.