/
Condition.java
31 lines (28 loc) · 1.04 KB
/
Condition.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package org.openxava.annotations;
import java.lang.annotation.*;
/**
* Restricts the elements that appear in the collection. <p>
*
* Applies to collections.<p>
*
* You have full freedom to define how the collection data is obtained,
* with condition you can overwrite the default condition generated by OpenXava:
* <pre>
* @Condition(
* "${warehouse.zoneNumber} = ${this.warehouse.zoneNumber} AND " +
* "${warehouse.number} = ${this.warehouse.number} AND " +
* "NOT (${number} = ${this.number})"
* )
* </pre>
* If you have this collection within Carrier, you can obtain with this collection
* all carriers of the same warehouse but not himself, that is the list of his
* fellow workers. As you see you can use this in the condition in order to
* reference the value of a property of current object.
*
* @author Javier Paniza
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.FIELD, ElementType.METHOD })
public @interface Condition {
String value();
}