T - Java type associated with this typepublic interface Type<T> extends Named, Copyable<Type<T>>
An engine's internal type which is assigned to every fact before it gets into the session's working memory. It allows for dynamic, real-time field declarations either as functional interfaces or via the Java Reflection API.
| Modifier and Type | Method and Description |
|---|---|
default TypeField |
declareBooleanField(String name,
Predicate<T> function)
Method declares a primitive
boolean field. |
default TypeField |
declareDoubleField(String name,
ToDoubleFunction<T> function)
Method declares a primitive
double field. |
<V> TypeField |
declareField(String name,
Class<V> type,
Function<T,V> function)
Field declaration with a
Function as value reader. |
default TypeField |
declareIntField(String name,
ToIntFunction<T> function)
Method declares a primitive
int field. |
default TypeField |
declareLongField(String name,
ToLongFunction<T> function)
Method declares a primitive
long field. |
Collection<TypeField> |
getDeclaredFields()
Method returns ALL known fields, both explicitly declared and resolved.
|
TypeField |
getField(int id)
Returns a declared field with the given name, or null
if no such field is found or resolved
|
TypeField |
getField(String name)
Returns a declared field with the given name, or null
if no such field is found or resolved
|
int |
getId()
Each type is assigned a unique auto-increment int identifier which developers can use in SPI implementations,
for example in sharding/partitioning data collections.
|
Class<T> |
getJavaType()
There can be only one Type with the given name, but there could be
many types associated with a specific Java Class.
|
int getId()
Each type is assigned a unique auto-increment int identifier which developers can use in SPI implementations, for example in sharding/partitioning data collections.
Class<T> getJavaType()
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.
Collection<TypeField> getDeclaredFields()
Method returns ALL known fields, both explicitly declared and resolved.
TypeFieldTypeField getField(String name)
Returns a declared field with the given name, or null if no such field is found or resolved
name - field nameTypeField getField(int id)
Returns a declared field with the given name, or null if no such field is found or resolved
id - field name<V> TypeField declareField(String name, Class<V> type, Function<T,V> function)
Field declaration with a Function as value reader.
V - field value generic typename - field nametype - field value classfunction - the function that will be used to read field's valuedefault TypeField declareIntField(String name, ToIntFunction<T> function)
Method declares a primitive int field.
name - field namefunction - field functional interfacedefault TypeField declareLongField(String name, ToLongFunction<T> function)
Method declares a primitive long field.
name - field namefunction - field functional interfacedefault TypeField declareDoubleField(String name, ToDoubleFunction<T> function)
Method declares a primitive double field.
name - field namefunction - field functional interfaceCopyright © 2021. All rights reserved.