Package tech.harmonysoft.oss.common.type
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
-
-
Method Summary
Modifier and Type Method Description abstract TmaybeParse(String rawValue)Tries to parse value of the target type from its given string representation. IntegercompareTo(T first, T second)BooleanareEqual(T first, T second)abstract KClass<T>getTargetType()Target data type covered by the current manager. abstract TypeManagerContextgetTargetContext()Normally type managers are bound to particular type (targetType property). -
-
Method Detail
-
maybeParse
abstract T maybeParse(String rawValue)
Tries to parse value of the target type from its given string representation.
- Returns:
non-
nullin case of successful parse
-
getTargetType
abstract KClass<T> getTargetType()
Target data type covered by the current manager.
-
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'asvalue(strip single quotes).So, normally all objects which implement this interface should have unique combination of targetType and this property
-
-
-
-