Class TypeWrapper<T>

java.lang.Object
org.evrete.api.TypeWrapper<T>
All Implemented Interfaces:
Copyable<Type<T>>, Named, Type<T>

public class TypeWrapper<T>
extends Object
implements Type<T>
  • Constructor Details

    • TypeWrapper

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

    • 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 Class<T> 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:
      Java Class associated with the type.
    • getName

      public final String getName()
      Specified by:
      getName in interface Named
    • 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, or null if no such field is found or resolved

      Specified by:
      getField in interface Type<T>
      Parameters:
      name - field name
      Returns:
      a declared field or null
    • 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
    • getField

      public TypeField getField​(int id)
      Description copied from interface: Type

      Returns a declared field with the given name, or null if no such field is found or resolved

      Specified by:
      getField in interface Type<T>
      Parameters:
      id - field name
      Returns:
      a declared field or null
    • copyOf

      public Type<T> copyOf()
      Specified by:
      copyOf in interface Copyable<T>
    • equals

      public final boolean equals​(Object o)
      Overrides:
      equals in class Object
    • hashCode

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