-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathRefinementAlias.java
More file actions
54 lines (50 loc) · 1.41 KB
/
RefinementAlias.java
File metadata and controls
54 lines (50 loc) · 1.41 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package liquidjava.specification;
import java.lang.annotation.ElementType;
import java.lang.annotation.Repeatable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Annotation to create a refinement alias to be reused in refinements.
* <p>
* Refinement aliases can be used to define reusable refinement predicates with parameters.
* They help reduce duplication and improve readability of complex refinement specifications.
* <p>
* <strong>Example:</strong>
* <pre>
* {@code
* @RefinementAlias("Nat(int x) { x > 0 }")
* public class MyClass {
* @Refinement("Nat(_)")
* int value;
* }
* }
* </pre>
*
* @see Refinement
* @author Catarina Gamboa
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE})
@Repeatable(RefinementAlias.Multiple.class)
public @interface RefinementAlias {
/**
* The refinement alias string, which includes the name of the alias, its parameters and the refinement itself.
* <p>
* <strong>Example:</strong>
* <pre>
* {@code
* @RefinementAlias("Nat(int x) { x > 0 }")
* }
* </pre>
*/
String value();
/**
* Container annotation used by {@link Repeatable} to support multiple refinement aliases.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE})
@interface Multiple {
RefinementAlias[] value();
}
}