Class VariableTypeInheritanceSearch

java.lang.Object
org.eclipse.yasson.internal.VariableTypeInheritanceSearch

class VariableTypeInheritanceSearch extends Object
Search for type variable in inheritance hierarchy and resolve if possible.
  • Field Details

  • Constructor Details

    • VariableTypeInheritanceSearch

      VariableTypeInheritanceSearch()
  • Method Details

    • searchParametrizedType

      Type searchParametrizedType(Type typeToSearch, TypeVariable<?> typeVar)
      Searches the hierarchy of classes to resolve a type variable. If typevar resolved value is another typevar redirection (propagated from wrapping class), this typevar is returned.
      
       Example 1: typevar is resolved
      
      
       class GenericClass <T> {
           private T genericField;
       }
       class ConcreteClass extends GenericClass<MyPojo> {
           //...
       }
      
       In above case when ConcreteClass type is passed as runtime type and <T> as type variable, T is resolved to MyPojo.
       
       Example 2: typevar is resolved to another propagated typevar
      
      
       class WrapperGenericClass<X> {
           private GenericClass<X> propagatedGenericField
       }
      
       class AnotherClass extends WrapperGenericClass<MyPojo> {
       }
      
      
       In second case when GenericClass ParameterizedType is passed as runtime type and <T> as type variable,
       T is resolved to propagated <X> by WrapperGenericClass.
      
       Resolution on <X> must be performed thereafter with AnotherClass runtime type.
       
      Parameters:
      typeToSearch - runtime type to search for typevar in, not null
      typeVar - type variable to resolve, not null
      Returns:
      resolved runtime type, or type variable
    • checkSubclassRuntimeInfo

      private Type checkSubclassRuntimeInfo(TypeVariable typeVar)
    • searchRuntimeTypeArgument

      private Type searchRuntimeTypeArgument(ParameterizedType runtimeType, TypeVariable<?> typeVar)
    • findParameterizedSuperclass

      private static ParameterizedType findParameterizedSuperclass(Type type)