org.optaplanner.core.impl.score.stream.drools.common

## Class DroolsInferredMetadata<A>

- java.lang.Object
- - org.optaplanner.core.impl.score.stream.drools.common.DroolsInferredMetadata<A>

- All Implemented Interfaces:
    DroolsMetadata<DroolsLogicalTuple,A>

      public final class DroolsInferredMetadata<A>
      extends Object
      implements DroolsMetadata<DroolsLogicalTuple,A>

- - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `org.drools.model.PatternDSL.PatternDef<DroolsLogicalTuple>` | `buildPattern()` A pattern is a way of accessing the variable in Drools.
    `A` | `extract(DroolsLogicalTuple container)` Extract variable value from the rule.
    `org.drools.model.Declaration<DroolsLogicalTuple>` | `getVariableDeclaration()`
    `DroolsInferredMetadata<A>` | `substitute(Supplier<org.drools.model.PatternDSL.PatternDef<DroolsLogicalTuple>> patternBuilder)` Create new `DroolsMetadata`, where its pattern will be different.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.optaplanner.core.impl.score.stream.drools.common.DroolsMetadata

      `ofGenuine, ofInferred, ofInferred`

- - ### Method Detail

    - #### extract

          public A extract(DroolsLogicalTuple container)

      Description copied from interface: `DroolsMetadata`
      Extract variable value from the rule. For genuine variables, this will be equivalent to `Function.identity()`. For inferred variables, this will refer to the `DroolsLogicalTuple.getItem(int)`.
      Specified by:
        `extract` in interface `DroolsMetadata<DroolsLogicalTuple,A>`
      Parameters:
        `container` - the variable from Drools on which to operate
      Returns:
        value of the variable

    - #### getVariableDeclaration

          public org.drools.model.Declaration<DroolsLogicalTuple> getVariableDeclaration()

      Specified by:
        `getVariableDeclaration` in interface `DroolsMetadata<DroolsLogicalTuple,A>`

    - #### buildPattern

          public org.drools.model.PatternDSL.PatternDef<DroolsLogicalTuple> buildPattern()

      Description copied from interface: `DroolsMetadata`
      A pattern is a way of accessing the variable in Drools. In some rules, patterns may be reused for several different constructs. Drools does not support reuse of pattern instances for different uses, and therefore we must create new ones every time we want to use them.
      Specified by:
        `buildPattern` in interface `DroolsMetadata<DroolsLogicalTuple,A>`
      Returns:
        pattern to give access to the variable

    - #### substitute

          public DroolsInferredMetadata<A> substitute(Supplier<org.drools.model.PatternDSL.PatternDef<DroolsLogicalTuple>> patternBuilder)

      Description copied from interface: `DroolsMetadata`
      Create new `DroolsMetadata`, where its pattern will be different.
      Specified by:
        `substitute` in interface `DroolsMetadata<DroolsLogicalTuple,A>`
      Parameters:
        `patternBuilder` - the new pattern to be returned by `DroolsMetadata.buildPattern()`. Typically reuses the parent pattern with some modifications.
      Returns:
        New instance of `DroolsMetadata`.

Copyright © 2006–2019 JBoss by Red Hat. All rights reserved.