-
Notifications
You must be signed in to change notification settings - Fork 599
/
OneToMany.java
68 lines (57 loc) · 2.18 KB
/
OneToMany.java
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package com.raizlabs.android.dbflow.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.List;
/**
* Description: Describes a 1-many relationship. It applies to some method that returns a {@link List} of Model objects.
* This annotation can handle loading, deleting, and saving when the current data changes. By default it will call the
* associated method when the containing class operates.
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.SOURCE)
public @interface OneToMany {
/**
* The method to apply the OneToMany to.
*/
enum Method {
/**
* Load this relationship when the parent model loads from the database. This is called before the OnLoadFromCursor
* method, but after other columns load.
*/
LOAD,
/**
* Inserts code to delete the results returned from the List relationship when the parent model is deleted.
*/
DELETE,
/**
* Inserts code to save the list of models when the parent model is saved.
*/
SAVE,
/**
* Shorthand to support all options.
*/
ALL
}
/**
* @return The methods you wish to call it from. By default it's loaded out of the DB.
*/
Method[] methods() default Method.LOAD;
/**
* @return The name of the list variable to use. If is left blank, we will remove the "get" and then decapitalize the remaining name.
*/
String variableName() default "";
/**
* @return If true, the underlying variable that we use is private, requiring us to provide
* a setter for it.
* @deprecated has no effect on the visibility of the call since we now autodetect visibility.
*/
@Deprecated
boolean isVariablePrivate() default false;
/**
* @return If true, the code generated for this relationship done as efficiently as possible.
* It will not work on nested relationships, caching, and other code that requires overriding of BaseModel or Model operations.
*/
boolean efficientMethods() default true;
}