Interface TypeConverter<X,​Y>

Type Parameters:
X - The underlying type supported by the entity view type system
Y - The type in the entity view model for which this converter adds support

public interface TypeConverter<X,​Y>
A contract for a converter to convert between an entity view model type and an underlying type.
Since:
1.2.0
Author:
Christian Beikov
  • Method Summary

    Modifier and Type Method Description
    X convertToUnderlyingType​(Y object)
    Converts the object from entity view model type to the underlying type.
    Y convertToViewType​(X object)
    Converts the object from underlying type to the entity view model type.
    Class<?> getUnderlyingType​(Class<?> owningClass, Type declaredType)
    Extract the underlying type from the declared type.
  • Method Details

    • getUnderlyingType

      Class<?> getUnderlyingType​(Class<?> owningClass, Type declaredType)
      Extract the underlying type from the declared type. The owning class is the concrete entity view class which contains a field or method of the declared type.
      Parameters:
      owningClass - The class owning the declared type
      declaredType - The declared type as present in the entity view model
      Returns:
      The actual underlying type
    • convertToViewType

      Y convertToViewType​(X object)
      Converts the object from underlying type to the entity view model type.
      Parameters:
      object - The object to convert
      Returns:
      The converted object
    • convertToUnderlyingType

      X convertToUnderlyingType​(Y object)
      Converts the object from entity view model type to the underlying type.
      Parameters:
      object - The object to convert
      Returns:
      The converted object