@@ -65,7 +65,11 @@ public final class GenerateQuery {
65
65
private GenerateQuery () {
66
66
}
67
67
68
-
68
+ /**
69
+ *
70
+ * @param cl the class
71
+ * @return the proxified object
72
+ */
69
73
@ SuppressWarnings ("unchecked" )
70
74
public static <T > T createQueryEntity (Class <T > cl ) {
71
75
Class <?> proxied = null ;
@@ -77,7 +81,6 @@ public static <T> T createQueryEntity(Class<T> cl) {
77
81
.method (ElementMatchers .not (ElementMatchers .isClone ().or (ElementMatchers .isFinalizer ()).or (ElementMatchers .isEquals ()).or (ElementMatchers .isHashCode ()).or (ElementMatchers .isToString ())))
78
82
.intercept (MethodDelegation .to (new MyMethodInterceptor ()))
79
83
.make ()
80
- // .load(cl.getClassLoader(), ClassLoadingStrategy.Default.WRAPPER)
81
84
.load (ClassLoader .getSystemClassLoader (), ClassLoadingStrategy .Default .WRAPPER )
82
85
.getLoaded ();
83
86
}
@@ -88,6 +91,11 @@ public static <T> T createQueryEntity(Class<T> cl) {
88
91
}
89
92
}
90
93
94
+ /**
95
+ *
96
+ * @param entity the entity
97
+ * @return the proxified object
98
+ */
91
99
@ SuppressWarnings ("unchecked" )
92
100
public static <T > T createQueryEntity (T entity ) {
93
101
Class <?> cl = entity .getClass ();
@@ -97,14 +105,9 @@ public static <T> T createQueryEntity(T entity) {
97
105
} else {
98
106
proxied = new ByteBuddy ()
99
107
.subclass (cl )
100
- // .method(ElementMatchers.any())
101
- // .intercept(MethodDelegation.to(new MyMethodInterceptor()))
102
- // .method(ElementMatchers.isClone().or(ElementMatchers.isFinalizer()).or(ElementMatchers.isEquals()).or(ElementMatchers.isHashCode()).or(ElementMatchers.isToString()))
103
- // .intercept(SuperMethodCall.INSTANCE)
104
108
.method (ElementMatchers .not (ElementMatchers .isClone ().or (ElementMatchers .isFinalizer ()).or (ElementMatchers .isEquals ()).or (ElementMatchers .isHashCode ()).or (ElementMatchers .isToString ())))
105
109
.intercept (MethodDelegation .to (new MyMethodInterceptor ()))
106
110
.make ()
107
- // .load(cl.getClassLoader(), ClassLoadingStrategy.Default.WRAPPER)
108
111
.load (ClassLoader .getSystemClassLoader (), ClassLoadingStrategy .Default .WRAPPER )
109
112
.getLoaded ();
110
113
}
@@ -271,18 +274,4 @@ public static void setMessage(QueryMessage mess) {
271
274
public static void resetQueryMessage () {
272
275
setMessage (new QueryMessage ());
273
276
}
274
-
275
-
276
- public static void main (String [] args ) {
277
- Customer customer = createQueryEntity (Customer .class );
278
- String query = select ($ (customer .getId ()), $ (customer .getDisplayName ())).where ($ (customer .getId ()).eq ("10" )).generate ();
279
- System .out .println (query );
280
- // Class<?> proxied = new ByteBuddy()
281
- // .subclass(Customer.class)
282
- // .method(ElementMatchers.not(ElementMatchers.isClone().or(ElementMatchers.isFinalizer()).or(ElementMatchers.isEquals()).or(ElementMatchers.isHashCode()).or(ElementMatchers.isToString())))
283
- // .intercept(MethodDelegation.to(new MyMethodInterceptor()))
284
- // .make()
285
- // .load(ClassLoader.getSystemClassLoader(), ClassLoadingStrategy.Default.WRAPPER)
286
- // .getLoaded();
287
- }
288
277
}
0 commit comments