| title | @RefinementAlias |
|---|---|
| parent | Annotations |
| nav_order | 2 |
| permalink | /annotations/refinement-alias/ |
| description | Learn how to reuse common refinement predicates with aliases to keep contracts shorter and easier to maintain. |
When the same refinement appears repeatedly, you can define it once with @RefinementAlias and reuse it inside other refinements.
import liquidjava.specification.*;
@RefinementAlias("Percentage(int v) { 0 <= v && v <= 100 }")
public class MyClass {
@Refinement("Percentage(x)")
int x = 25;
@Refinement("Percentage(y)")
int y = 75;
}This helps keep contracts shorter and easier to maintain by replacing repeated predicates with a domain-specific alias.