Package org.drools.core.rule.constraint
Class XpathConstraint
- java.lang.Object
-
- org.drools.core.rule.MutableTypeConstraint
-
- org.drools.core.rule.constraint.XpathConstraint
-
- All Implemented Interfaces:
Externalizable
,Serializable
,Cloneable
,AlphaNodeFieldConstraint
,BetaNodeFieldConstraint
,Constraint
,RuleComponent
public class XpathConstraint extends MutableTypeConstraint
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
XpathConstraint.XpathChunk
static class
XpathConstraint.XpathDataProvider
-
Nested classes/interfaces inherited from interface org.drools.core.spi.Constraint
Constraint.ConstraintType
-
-
Constructor Summary
Constructors Constructor Description XpathConstraint()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description XpathConstraint.XpathChunk
addChunck(Class<?> clazz, String field, int index, boolean iterate, boolean lazy)
XpathConstraint
clone()
Clones the constraintContextEntry
createContextEntry()
LinkedList<XpathConstraint.XpathChunk>
getChunks()
Declaration
getDeclaration()
InternalReadAccessor
getReadAccessor()
Declaration[]
getRequiredDeclarations()
Returns all the declarations required by the given constraint implementation.Class<?>
getResultClass()
Constraint.ConstraintType
getType()
Returns the type of the constraint, either ALPHA, BETA or UNKNOWNDeclaration
getXpathStartDeclaration()
boolean
isAllowed(InternalFactHandle handle, InternalWorkingMemory workingMemory)
boolean
isAllowedCachedLeft(ContextEntry context, InternalFactHandle handle)
boolean
isAllowedCachedRight(Tuple tuple, ContextEntry context)
boolean
isTemporal()
Returns true in case this constraint is a temporal constraintvoid
readExternal(ObjectInput in)
void
replaceDeclaration(Declaration oldDecl, Declaration newDecl)
When a rule contains multiple logical branches, i.e., makes use of 'OR' CE, it is required to clone patterns and declarations for each logical branch.void
setDeclaration(Declaration declaration)
void
setXpathStartDeclaration(Declaration xpathStartDeclaration)
String
toString()
void
writeExternal(ObjectOutput out)
-
Methods inherited from class org.drools.core.rule.MutableTypeConstraint
cloneIfInUse, setInUse, setType
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.drools.core.spi.Constraint
addPackageNames, equals, getListenedPropertyMask, getListenedPropertyMask, getPackageNames, mergeEvaluationContext, registerEvaluationContext
-
-
-
-
Method Detail
-
addChunck
public XpathConstraint.XpathChunk addChunck(Class<?> clazz, String field, int index, boolean iterate, boolean lazy)
-
getType
public Constraint.ConstraintType getType()
Description copied from interface:Constraint
Returns the type of the constraint, either ALPHA, BETA or UNKNOWN- Specified by:
getType
in interfaceConstraint
- Overrides:
getType
in classMutableTypeConstraint
- Returns:
-
getRequiredDeclarations
public Declaration[] getRequiredDeclarations()
Description copied from interface:Constraint
Returns all the declarations required by the given constraint implementation.- Returns:
-
replaceDeclaration
public void replaceDeclaration(Declaration oldDecl, Declaration newDecl)
Description copied from interface:Constraint
When a rule contains multiple logical branches, i.e., makes use of 'OR' CE, it is required to clone patterns and declarations for each logical branch. Since this is done at ReteOO build type, when constraints were already created, eventually some constraints need to update their references to the declarations.
-
clone
public XpathConstraint clone()
Description copied from interface:Constraint
Clones the constraint- Specified by:
clone
in interfaceConstraint
- Specified by:
clone
in classMutableTypeConstraint
- Returns:
-
isTemporal
public boolean isTemporal()
Description copied from interface:Constraint
Returns true in case this constraint is a temporal constraint- Returns:
-
isAllowedCachedLeft
public boolean isAllowedCachedLeft(ContextEntry context, InternalFactHandle handle)
-
isAllowedCachedRight
public boolean isAllowedCachedRight(Tuple tuple, ContextEntry context)
-
createContextEntry
public ContextEntry createContextEntry()
-
isAllowed
public boolean isAllowed(InternalFactHandle handle, InternalWorkingMemory workingMemory)
-
readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- Specified by:
readExternal
in interfaceExternalizable
- Overrides:
readExternal
in classMutableTypeConstraint
- Throws:
IOException
ClassNotFoundException
-
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Specified by:
writeExternal
in interfaceExternalizable
- Overrides:
writeExternal
in classMutableTypeConstraint
- Throws:
IOException
-
getChunks
public LinkedList<XpathConstraint.XpathChunk> getChunks()
-
getResultClass
public Class<?> getResultClass()
-
getDeclaration
public Declaration getDeclaration()
-
setDeclaration
public void setDeclaration(Declaration declaration)
-
getReadAccessor
public InternalReadAccessor getReadAccessor()
-
getXpathStartDeclaration
public Declaration getXpathStartDeclaration()
-
setXpathStartDeclaration
public void setXpathStartDeclaration(Declaration xpathStartDeclaration)
-
-