Interface FieldReference


public interface FieldReference

Field references go along with rule conditions and are the key source of knowledge for building the Rete memory graph. Each field reference consists of a NamedType and the type's property/field TypeField. For example, the following condition

.where("$a.id > $b.type")

contains two field references: one is referring the id property in a named type $a, and the other is related to the field type in a named type $b.

If condition is a string literal, the engine will consult with ExpressionResolverProvider to determine the condition's field references. If you decide to use Java's Predicate or the library's ValuesPredicate as a condition, then the corresponding field references must be explicitly specified like in LhsBuilder.where(ValuesPredicate, String...) or in LhsBuilder.where(ValuesPredicate, FieldReference...)

If you decide to use functional interfaces instead of literal conditions, then using String arrays is the most convenient form of providing field references:


 .where(predicate, "$a.id", "$b.type")
 

In that case, the engine will consult with the rule's declared fact types and automatically resolve these two string references into a FieldReference array.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final FieldReference[]
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Retrieves the TypeField associated with this FieldReference.
    default boolean
    Checks if the given FieldReference is the same as the current FieldReference.
    static boolean
     
    Returns the named type associated with this method.
  • Field Details

  • Method Details

    • sameAs

      static boolean sameAs(FieldReference[] refs1, FieldReference[] refs2)
    • field

      TypeField field()
      Retrieves the TypeField associated with this FieldReference.
      Returns:
      the TypeField associated with this FieldReference
    • type

      NamedType type()
      Returns the named type associated with this method.
      Returns:
      the named type associated with this method
    • sameAs

      default boolean sameAs(FieldReference other)
      Checks if the given FieldReference is the same as the current FieldReference.
      Parameters:
      other - the FieldReference to compare with
      Returns:
      true if the FieldReferences are the same, false otherwise