Predicates

A predicate is an expression that evaluates to true or false for a certain object.

With predicates you can specify logical expressions in Ant. Some plugins might use these predicates during code generation. There are basic logical predicates and special column predicates. Currently, only the cmp20 plugin uses predicates to control what finders should be generated.

Predicates can be combined in many ways to construct complex logical expressions. There are two kinds of predicates: Composite predicates and simple predicates.

Composite predicates require sub-predicates. Simple predicates can not have any sub-predicates.

Basic logical predicates

and

Logical AND. (Composite predicate).

or

Logical OR. (Composite predicate).

not

Logical NOT. (Composite predicate).

true

Logical TRUE. (Simple predicate).

false

Logical FALSE. (Simple predicate).

Column predicates

Column predicates eveluate to true or false for a column.

fk

Evaluates to true if a column is part of a foreign key. (Simple predicate).

pk

Evaluates to true if a column is part of a primary key. (Simple predicate).

mandatory

Evaluates to true if a column is mandatory (NOT NULL). (Simple predicate).

indexed

Evaluates to true if a column is indexed. (Simple predicate).

sqltype

Evaluates to true if a column is of a certain SQL type. The SQL type must be specified in a name attribute. (Simple predicate).

notkey

Evaluates to true if a column is neither a foreign key or a primary key. (Simple predicate).

Example

<!-- All indexed columns that are not of type VARCHAR -->
<and>
  <indexed/>
  <not>
    <sqltype name="VARCHAR"/>
  </not>
</and>