Class BasicTypeConverter

java.lang.Object
jadex.common.transformation.BasicTypeConverter

public class BasicTypeConverter extends Object
Converter for basic types.
  • Field Details

  • Constructor Details

    • BasicTypeConverter

      public BasicTypeConverter()
      Create a new type converter.
      Parameters:
      converters - The contained converters.
    • BasicTypeConverter

      public BasicTypeConverter(Map<Class<?>,IStringObjectConverter> converters)
      Create a new type converter.
      Parameters:
      converters - The contained converters.
  • Method Details

    • convertString

      public Object convertString(String val, Class<?> type, Object context) throws Exception
      Convert a string value.
      Parameters:
      val - The string value.
      type - The target class.
      context - The conversion context.
      Returns:
      The converted value.
      Throws:
      Exception
    • convertObject

      public String convertObject(Object val, Class<?> type, Object context) throws Exception
      Convert a string value.
      Parameters:
      val - The string value.
      type - The target class.
      context - The conversion context.
      Returns:
      The converted value.
      Throws:
      Exception
    • addConverter

      public void addConverter(Class<?> type, IStringObjectConverter converter)
      Add a new converter.
      Parameters:
      type - The type.
      converter - The converter.
    • removeConverter

      public void removeConverter(Class<?> type)
      Remove a converter.
      Parameters:
      type - The type.
    • isSupportedType

      public boolean isSupportedType(Class<?> clazz)
      Test if a clazz is a built-in type.
      Parameters:
      clazz - The clazz.
      Returns:
      True, if built-in type.
    • getStringConverter

      public IStringObjectConverter getStringConverter(Class<?> clazz)
      Get a String -> X converter for a target clazz.
      Parameters:
      clazz - The clazz.
      Returns:
      converter The converter.
    • getObjectConverter

      public IObjectStringConverter getObjectConverter(Class<?> clazz)
      Get a X -> String converter for a source clazz.
      Parameters:
      clazz - The clazz.
      Returns:
      converter The converter.
    • isBuiltInType

      public static boolean isBuiltInType(Class<?> clazz)
      Test if a clazz is a built-in type.
      Parameters:
      clazz - The clazz.
      Returns:
      True, if built-in type.
    • getBasicStringConverter

      public static IStringObjectConverter getBasicStringConverter(Class<?> clazz)
      Get a String -> X converter for a target clazz.
      Parameters:
      clazz - The clazz.
      Returns:
      converter The converter.
    • getBasicObjectConverter

      public static IObjectStringConverter getBasicObjectConverter(Class<?> clazz)
      Get a X -> String converter for a source clazz.
      Parameters:
      clazz - The clazz.
      Returns:
      converter The converter.
    • getConverters

      public Map<Class<?>,IStringObjectConverter> getConverters()
      Get converters copy.
      Returns:
      Get a copy of the converters.
    • getExtendedConverters

      public Map<Class<?>,IStringObjectConverter> getExtendedConverters()
      Get extended converters copy.
      Returns:
      Get a copy of the extended converters.