Skip to content

Commit d3b124c

Browse files
committed
[backend] docs(queryable): Add javadoc on Queryable annotation
1 parent 0ebd2de commit d3b124c

File tree

1 file changed

+37
-3
lines changed

1 file changed

+37
-3
lines changed

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

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,51 @@
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, filtered, sorted or
11+
* dynamically resolved by the query engine.
12+
*
13+
* <p>This annotation provides metadata to drive the construction of dynamic Spring Specifications
14+
* and to expose query capabilities to higher-level components (API, UI, query builders, etc.).
15+
*
16+
* <p>It can be applied to fields or getter methods.
17+
*/
918
@Retention(RetentionPolicy.RUNTIME)
1019
@Target({ElementType.FIELD, ElementType.METHOD})
1120
public @interface Queryable {
21+
22+
/**
23+
* Enables free-text search on this property (e.g. using LIKE/ILIKE operators depending on the
24+
* backend).
25+
*/
1226
boolean searchable() default false;
1327

28+
/** Allows filtering this property using supported filter operators. */
1429
boolean filterable() default false;
1530

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

38+
/** Allows sorting results based on this property. */
1839
boolean sortable() default false;
1940

41+
/** Human-readable label used for documentation or UI generation. */
2042
String label() default "";
2143

44+
/**
45+
* Defines the JPA path used to query this property. Follows Spring Data Specification conventions
46+
* (e.g. {@code "organization.id"}).
47+
*/
2248
String path() default "";
2349

50+
/**
51+
* Defines multiple possible JPA paths, when the property can be resolved through different
52+
* relationships or aliases.
53+
*/
2454
String[] paths() default {};
2555

2656
Filters.FilterOperator[] overrideOperators() default {};
@@ -29,8 +59,12 @@
2959

3060
Class refEnumClazz() default Unassigned.class;
3161

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
62+
/**
63+
* Special sentinel class used to represent an "unassigned" state for {@link #clazz()} and {@link
64+
* #refEnumClazz()}.
65+
*
66+
* <p>We cannot use {@code Void.class} here since {@code void} is a valid type and could lead to
67+
* ambiguity.
68+
*/
3569
class Unassigned {}
3670
}

0 commit comments

Comments
 (0)