Class TypeWrapper<T>
- java.lang.Object
-
- org.evrete.api.TypeWrapper<T>
-
-
Constructor Summary
Constructors Constructor Description TypeWrapper(Type<T> delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Type<T>copyOf()<V> TypeFielddeclareField(String name, Class<V> type, Function<T,V> function)Field declaration with aFunctionas value reader.booleanequals(Object o)Collection<TypeField>getDeclaredFields()Method returns ALL known fields, both explicitly declared and resolved.Type<T>getDelegate()TypeFieldgetField(String name)Returns a declared field with the given name.intgetId()Each type is assigned a unique auto-increment int identifier which developers can use in SPI implementations, for example in sharding/partitioning data collections.StringgetJavaType()There can be only one Type with the given name, but there could be many types associated with a specific Java Class.StringgetName()inthashCode()Class<T>resolveJavaType()-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.evrete.api.Type
declareBooleanField, declareDoubleField, declareIntField, declareLongField
-
-
-
-
Method Detail
-
getId
public final int getId()
Description copied from interface:TypeEach type is assigned a unique auto-increment int identifier which developers can use in SPI implementations, for example in sharding/partitioning data collections.
-
getJavaType
public final String getJavaType()
Description copied from interface:TypeThere 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:
getJavaTypein interfaceType<T>- Returns:
- name of the Java Class associated with the type.
-
resolveJavaType
public Class<T> resolveJavaType()
- Specified by:
resolveJavaTypein interfaceType<T>
-
getDeclaredFields
public Collection<TypeField> getDeclaredFields()
Description copied from interface:TypeMethod returns ALL known fields, both explicitly declared and resolved.
- Specified by:
getDeclaredFieldsin interfaceType<T>- Returns:
- Collection of declared fields
- See Also:
TypeField
-
getField
public TypeField getField(String name)
Description copied from interface:TypeReturns 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
IllegalArgumentExceptionEmpty field name has a special meaning of the
"this"value, i.e. such field's values represent the type's instances themself.
-
declareField
public <V> TypeField declareField(String name, Class<V> type, Function<T,V> function)
Description copied from interface:TypeField declaration with a
Functionas value reader.- Specified by:
declareFieldin interfaceType<T>- Type Parameters:
V- field value generic type- Parameters:
name- field nametype- field value classfunction- the function that will be used to read field's value- Returns:
- a newly created field or an existing one if already declared/resolved
-
-