Skip to content

Commit 8f0d3a1

Browse files
committed
[backend] docs: Queryable javadoc
1 parent 0ebd2de commit 8f0d3a1

File tree

1 file changed

+43
-3
lines changed

1 file changed

+43
-3
lines changed

openaev-model/src/main/java/io/openaev/annotation/Queryable.java

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,58 @@
66
import java.lang.annotation.RetentionPolicy;
77
import java.lang.annotation.Target;
88

9+
/**
10+
* Annotation used to describe whether a JPA bean property can be searched,
11+
* filtered, sorted or dynamically resolved by the query engine.
12+
*
13+
* <p>This annotation provides metadata to drive the construction of
14+
* dynamic Spring Specifications and to expose query capabilities to
15+
* higher-level components (API, UI, query builders, etc.).</p>
16+
*
17+
* <p>It can be applied to fields or getter methods.</p>
18+
*/
919
@Retention(RetentionPolicy.RUNTIME)
1020
@Target({ElementType.FIELD, ElementType.METHOD})
1121
public @interface Queryable {
22+
23+
/**
24+
* Enables free-text search on this property
25+
* (e.g. using LIKE/ILIKE operators depending on the backend).
26+
*/
1227
boolean searchable() default false;
1328

29+
/**
30+
* Allows filtering this property using supported filter operators.
31+
*/
1432
boolean filterable() default false;
1533

34+
/**
35+
* Indicates that the property refers to another entity stored in the database,
36+
* meaning its possible filter values must be retrieved dynamically.
37+
* Typically used for relations (ManyToOne, OneToMany, etc.).
38+
*/
1639
boolean dynamicValues() default false;
1740

41+
/**
42+
* Allows sorting results based on this property.
43+
*/
1844
boolean sortable() default false;
1945

46+
/**
47+
* Human-readable label used for documentation or UI generation.
48+
*/
2049
String label() default "";
2150

51+
/**
52+
* Defines the JPA path used to query this property.
53+
* Follows Spring Data Specification conventions (e.g. {@code "organization.id"}).
54+
*/
2255
String path() default "";
2356

57+
/**
58+
* Defines multiple possible JPA paths, when the property
59+
* can be resolved through different relationships or aliases.
60+
*/
2461
String[] paths() default {};
2562

2663
Filters.FilterOperator[] overrideOperators() default {};
@@ -29,8 +66,11 @@
2966

3067
Class refEnumClazz() default Unassigned.class;
3168

32-
// use this absolutely specific class as a "null" value for class, refEnumClazz
33-
// don't use Void here because that is a legitimate return type
34-
// although there is little to justify having a queryable void method
69+
/**
70+
* Special sentinel class used to represent an "unassigned" state for
71+
* {@link #clazz()} and {@link #refEnumClazz()}.
72+
* <p>We cannot use {@code Void.class} here since {@code void} is
73+
* a valid type and could lead to ambiguity.</p>
74+
*/
3575
class Unassigned {}
3676
}

0 commit comments

Comments
 (0)