ContainsConstraint

Representation of the Contains Constraint. Evaluates to true only if the left side fact is defined in the match context. If the left side is not defined, this will evaluate to False. Contains is typically used to check membership of a value in a group fact.

Constructor

ContainsConstraint(): Constructs a default constraint.

Fields Inherited from Binary Constraint

Summary:

MATCH_MODE_EXACT (0)

Exactly match the left and right sides of operation.

MATCH_MODE_REGEXP (1)

If possible, performs a regular expresion matching by treating the right side of the operation as a regular expression.This is only considered for String arguments.

MATCH_MODE_GLOB (2)

If possible, performs a glob-style matching by treating the right side of the operation as a glob expression. This is only considered for String arguments.

See BinaryConstraint.

Methods

Summary:

validate()

Overrides: validate in class BinaryConstraint.

Inherited from class com.gridion.jdl.BinaryConstraint

getMatchMode, setMatchMode

See BinaryConstraint.

Inherited from class Constraint

getFact, getFactValue, getReason, getValue, setFact, setFactValue, setReason, setValue

See Constraint.

Example

Example of building a ContainsConstraint to constrain that a resource belongs to a group:

          c = ContainsConstraint()
          c.setFact("resource.groups")
          c.setValue("webserver-group")

This constraint can be used independently or added to a AndConstraint>, OrConstraint, NotConstraint to combine with other constraints.

See Also

Javadoc: ContainsConstraint