Skip to content

Commit d9c0d72

Browse files
committed
add sorma2 generator stuff
1 parent f1e004f commit d9c0d72

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+4002
-0
lines changed

sorma2/.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
main.db
2+
com/zoffcc/applications/sorm/*.class
3+
org/example/*.class
4+
test/org/example/
5+
test/com/
6+
gen/com
7+
sorma_generated.jar

sorma2/Column.java

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
package com.zoffcc.applications.sorm;
2+
3+
4+
import java.lang.annotation.ElementType;
5+
import java.lang.annotation.Retention;
6+
import java.lang.annotation.RetentionPolicy;
7+
import java.lang.annotation.Target;
8+
9+
@Target({ElementType.FIELD})
10+
@Retention(RetentionPolicy.CLASS)
11+
public @interface Column
12+
{
13+
String value() default "";
14+
15+
boolean indexed() default false;
16+
17+
boolean unique() default false;
18+
19+
@OnConflict int uniqueOnConflict() default 0;
20+
21+
Column.ForeignKeyAction onDelete() default Column.ForeignKeyAction.CASCADE;
22+
23+
Column.ForeignKeyAction onUpdate() default Column.ForeignKeyAction.CASCADE;
24+
25+
String defaultExpr() default "";
26+
27+
Column.Collate collate() default Column.Collate.BINARY;
28+
29+
String storageType() default "";
30+
31+
@Column.Helpers long helpers() default 1L;
32+
33+
@Target({ElementType.FIELD, ElementType.LOCAL_VARIABLE, ElementType.PARAMETER, ElementType.METHOD})
34+
@Retention(RetentionPolicy.CLASS)
35+
public @interface Helpers
36+
{
37+
long NONE = 0L;
38+
long AUTO = 1L;
39+
long CONDITION_EQ = 2L;
40+
long CONDITION_NOT_EQ = 4L;
41+
long CONDITION_IS_NULL = 8L;
42+
long CONDITION_IS_NOT_NULL = 16L;
43+
long CONDITION_IN = 32L;
44+
long CONDITION_NOT_IN = 64L;
45+
long CONDITION_GLOB = 128L;
46+
long CONDITION_NOT_GLOB = 256L;
47+
long CONDITION_LIKE = 512L;
48+
long CONDITION_NOT_LIKE = 1024L;
49+
long CONDITION_LT = 2048L;
50+
long CONDITION_LE = 4096L;
51+
long CONDITION_GT = 8192L;
52+
long CONDITION_GE = 16384L;
53+
long CONDITION_BETWEEN = 32768L;
54+
long CONDITIONS = 65534L;
55+
long ORDER_IN_ASC = 65536L;
56+
long ORDER_IN_DESC = 131072L;
57+
long ORDERS = 196608L;
58+
long PLUCK = 262144L;
59+
long MIN = 524288L;
60+
long MAX = 1048576L;
61+
long SUM = 2097152L;
62+
long AVG = 4194304L;
63+
long AGGREGATORS = 7864320L;
64+
long ALL = 8388606L;
65+
}
66+
67+
public static enum ForeignKeyAction
68+
{
69+
NO_ACTION, RESTRICT, SET_NULL, SET_DEFAULT, CASCADE;
70+
71+
private ForeignKeyAction()
72+
{
73+
}
74+
}
75+
76+
public static enum Collate
77+
{
78+
BINARY, NOCASE, RTRIM;
79+
80+
private Collate()
81+
{
82+
}
83+
}
84+
}

sorma2/Index.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package com.zoffcc.applications.sorm;
2+
3+
import java.lang.annotation.ElementType;
4+
import java.lang.annotation.Retention;
5+
import java.lang.annotation.RetentionPolicy;
6+
import java.lang.annotation.Target;
7+
8+
@Target({ElementType.ANNOTATION_TYPE})
9+
@Retention(RetentionPolicy.CLASS)
10+
public @interface Index
11+
{
12+
String[] value();
13+
14+
boolean unique() default false;
15+
16+
String name() default "";
17+
18+
@Column.Helpers long helpers() default 1L;
19+
}
20+

0 commit comments

Comments
 (0)