Class TypeData<T>

  • Type Parameters:
    T - the underlying type being represented
    All Implemented Interfaces:
    TypeWithTypeParameters<T>
    Direct Known Subclasses:
    WildCardTypeData

    @MorphiaInternal
    public class TypeData<T>
    extends Object
    implements TypeWithTypeParameters<T>
    Holds type information about a type element
    Since:
    2.0
    Developer note.
    This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
    • Constructor Detail

      • TypeData

        public TypeData​(Class<T> type)
        Creates a new TypeData with the concrete type and type parameters around it.

        e.g., List<Address> would be

         
         new TypeData(Address.class, TypeData.builder(List.class).build())
         
         
        Parameters:
        type - the type
      • TypeData

        public TypeData​(Class<T> type,
                        List<TypeData<?>> typeParameters)
        Creates a new TypeData with the concrete type and type parameters around it.

        e.g., List<Address> would be

         
         new TypeData(Address.class, TypeData.builder(List.class).build())
         
         
        Parameters:
        type - the type
        typeParameters - the parameters
    • Method Detail

      • builder

        public static <T> TypeData.Builder<T> builder​(Class<T> type)
        Creates a new builder for ClassTypeData
        Type Parameters:
        T - the type
        Parameters:
        type - the class for the type
        Returns:
        the builder
      • get

        public static TypeData<?> get​(Field field)
        Creates a TypeData reflecting the type of the given field.
        Parameters:
        field - the field to analyze
        Returns:
        the new TypeData information
      • get

        public static TypeData<?> get​(Method method)
        Creates a TypeData reflecting the type of the given method.
        Parameters:
        method - the method to analyze
        Returns:
        the new TypeData information
      • newInstance

        public static <T> TypeData<T> newInstance​(Type genericType)
        Creates a TypeData reflecting the given generic type and class.
        Type Parameters:
        T - the type of the new TypeData instance
        Parameters:
        genericType - the type to analyze
        Returns:
        the new TypeData information
      • getArray

        public boolean getArray()
        Returns:
        true if an array
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • isArray

        public boolean isArray()
        Returns:
        true if an array
      • setArray

        public void setArray​(boolean array)
        Parameters:
        array -
      • withType

        public TypeData<?> withType​(Class<?> concreteClass)
        Creates a new TypeData with an updated type
        Parameters:
        concreteClass - the new type
        Returns:
        the new TypeData
        Since:
        2.2