Class TypeWrapper<T>

    • Constructor Detail

      • TypeWrapper

        public TypeWrapper​(Type<T> delegate)
    • Method Detail

      • getDelegate

        public final Type<T> getDelegate()
      • getId

        public final int getId()
        Description copied from interface: Type

        Each type is assigned a unique auto-increment int identifier which developers can use in SPI implementations, for example in sharding/partitioning data collections.

        Specified by:
        getId in interface Type<T>
        Returns:
        unique type identifier.
      • getJavaType

        public final String getJavaType()
        Description copied from interface: Type

        There can be only one Type with the given name, but there could be many types associated with a specific Java Class. This method returns the associated Java type.

        Specified by:
        getJavaType in interface Type<T>
        Returns:
        name of the Java Class associated with the type.
      • getDeclaredFields

        public Collection<TypeField> getDeclaredFields()
        Description copied from interface: Type

        Method returns ALL known fields, both explicitly declared and resolved.

        Specified by:
        getDeclaredFields in interface Type<T>
        Returns:
        Collection of declared fields
        See Also:
        TypeField
      • getField

        public TypeField getField​(String name)
        Description copied from interface: Type

        Returns a declared field with the given name. If no such field was explicitly declared, an attempt will be made to resolve the respective field/getter of the declared Java class. If no such field or getter is found, the method will throw IllegalArgumentException

        Empty field name has a special meaning of the "this" value, i.e. such field's values represent the type's instances themself.

        Specified by:
        getField in interface Type<T>
        Parameters:
        name - field name or empty string if the field denotes the type's this value
        Returns:
        declared or resolved field
      • declareField

        public <V> TypeField declareField​(String name,
                                          Class<V> type,
                                          Function<T,​V> function)
        Description copied from interface: Type

        Field declaration with a Function as value reader.

        Specified by:
        declareField in interface Type<T>
        Type Parameters:
        V - field value generic type
        Parameters:
        name - field name
        type - field value class
        function - the function that will be used to read field's value
        Returns:
        a newly created field or an existing one if already declared/resolved
      • hashCode

        public final int hashCode()
        Overrides:
        hashCode in class Object