Interface TypeManager

  • All Implemented Interfaces:

    
    public interface TypeManager<T extends Object>
    
                        

    We have a number of use-cases when it's necessary to do type-specific manipulations, for example, parse objects from their string representations.

    This interface defines API for such type-specific operations

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      abstract T maybeParse(String rawValue) Tries to parse value of the target type from its given string representation.
      Integer compareTo(T first, T second)
      Boolean areEqual(T first, T second)
      abstract KClass<T> getTargetType() Target data type covered by the current manager.
      abstract TypeManagerContext getTargetContext() Normally type managers are bound to particular type (targetType property).
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • maybeParse

         abstract T maybeParse(String rawValue)

        Tries to parse value of the target type from its given string representation.

        Returns:

        non-null in case of successful parse

      • getTargetContext

         abstract TypeManagerContext getTargetContext()

        Normally type managers are bound to particular type (targetType property). However, sometimes that is not enough. Consider, for example String - normally we use it as-is but for SQL context we want to parse values like 'value' as value (strip single quotes).

        So, normally all objects which implement this interface should have unique combination of targetType and this property