-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathDependency.java
More file actions
35 lines (30 loc) · 1.13 KB
/
Dependency.java
File metadata and controls
35 lines (30 loc) · 1.13 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
package solutions.bellatrix.data.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Annotation to mark fields that require automatic dependency creation.
* When a field is marked with this annotation and its value is null,
* the system will automatically create the dependent entity using
* the registered factory and repository.
*/
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface Dependency {
/**
* The entity class that should be created as a dependency.
* This class must have a registered factory and repository.
*/
Class<?> entityType();
/**
* Optional: Custom factory method name to use for creating the dependency.
* If not specified, the default factory method will be used.
*/
String factoryMethod() default "buildDefault";
/**
* Optional: Whether to create the dependency even if the field is not null.
* Default is false (only create if field is null).
*/
boolean forceCreate() default false;
}