Class GenericUtils

java.lang.Object
org.neo4j.ogm.metadata.reflect.GenericUtils

public final class GenericUtils extends Object
Contains a stripped down version of Jonathan Halterman's TypeResolver from Typetools.
Author:
Frantisek Hartman, Michael J. Simons
  • Method Details

    • isGenericField

      public static boolean isGenericField(Field field)
      Helper to check whether a given field is a generic field (A field described by a type variable).
      Parameters:
      field - The field to check for a type variable
      Returns:
      True, if field is a generic field.
    • isParameterizedField

      public static boolean isParameterizedField(Field field)
      Helper to check whether a given field is a parameterized field (A field described by a type variable presenting a parameter type).
      Parameters:
      field - The field to check for a parameterized type
      Returns:
      True, if field is a parameterized field.
    • findFieldType

      public static Class findFieldType(Field field, Class concreteClass)
      Tries to discover type of given field. If the field ha a concrete type then there is nothing to do and it's type is returned. If the field has a generic type then it traverses class hierarchy of the concrete class to discover ParameterizedType with type parameter. If the field is parameterized but no parameter can be discovered, than Object.class will be returned.
      Parameters:
      field - field
      concreteClass - concrete class that either declares the field or is a subclass of such class
      Returns:
      type of the field