Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
51c50415e1 | ||
|
|
2f08fa6476 | ||
|
|
3091972fc5 | ||
|
|
8e14df9a95 | ||
|
|
683cec6f4d | ||
|
|
ec6e5aa3b1 | ||
|
|
f4c00a9b6f | ||
|
|
c071ec5d6c | ||
|
|
29148c4b42 | ||
|
|
7340caa4a9 | ||
|
|
7d23dfa73d | ||
|
|
19932820a9 |
@@ -207,7 +207,9 @@ public final class ClassFilter<T> {
|
|||||||
} catch (Throwable cfe) {
|
} catch (Throwable cfe) {
|
||||||
if (finest && !clazzname.startsWith("sun.") && !clazzname.startsWith("javax.")
|
if (finest && !clazzname.startsWith("sun.") && !clazzname.startsWith("javax.")
|
||||||
&& !clazzname.startsWith("com.sun.") && !clazzname.startsWith("jdk.") && !clazzname.startsWith("META-INF")
|
&& !clazzname.startsWith("com.sun.") && !clazzname.startsWith("jdk.") && !clazzname.startsWith("META-INF")
|
||||||
&& (!(cfe instanceof NoClassDefFoundError) || (cfe instanceof UnsupportedClassVersionError) || ((NoClassDefFoundError) cfe).getMessage().startsWith("java.lang.NoClassDefFoundError: java"))) {
|
&& !clazzname.startsWith("com.mysql.") && !clazzname.startsWith("com.microsoft.")
|
||||||
|
&& !clazzname.startsWith("org.redkale") && (clazzname.contains("Service") || clazzname.contains("Servlet"))) {
|
||||||
|
//&& (!(cfe instanceof NoClassDefFoundError) || (cfe instanceof UnsupportedClassVersionError) || ((NoClassDefFoundError) cfe).getMessage().startsWith("java.lang.NoClassDefFoundError: java"))) {
|
||||||
logger.log(Level.FINEST, ClassFilter.class.getSimpleName() + " filter error for class: " + clazzname + (url == null ? "" : (" in " + url)), cfe);
|
logger.log(Level.FINEST, ClassFilter.class.getSimpleName() + " filter error for class: " + clazzname + (url == null ? "" : (" in " + url)), cfe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -560,6 +560,17 @@ public abstract class WebSocket<G extends Serializable, T> {
|
|||||||
return _engine.node.forceCloseWebSocket(userid);
|
return _engine.node.forceCloseWebSocket(userid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取WebSocketNode
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @return WebSocketNode
|
||||||
|
*/
|
||||||
|
@Comment("获取WebSocketNode")
|
||||||
|
public final WebSocketNode webSocketNode() {
|
||||||
|
return _engine.node;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取当前WebSocket下的属性,非线程安全
|
* 获取当前WebSocket下的属性,非线程安全
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1050,9 +1050,9 @@ public abstract class DataSqlSource<DBChannel> extends AbstractService implement
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (setsql.length() < 1) return CompletableFuture.completedFuture(0);
|
if (setsql.length() < 1) return CompletableFuture.completedFuture(0);
|
||||||
Map<Class, String> joinTabalis = node.getJoinTabalis();
|
Map<Class, String> joinTabalis = node == null ? null : node.getJoinTabalis();
|
||||||
CharSequence join = node.createSQLJoin(this, true, joinTabalis, new HashSet<>(), info);
|
CharSequence join = node == null ? null : node.createSQLJoin(this, true, joinTabalis, new HashSet<>(), info);
|
||||||
CharSequence where = node.createSQLExpress(info, joinTabalis);
|
CharSequence where = node == null ? null : node.createSQLExpress(info, joinTabalis);
|
||||||
StringBuilder join1 = null;
|
StringBuilder join1 = null;
|
||||||
StringBuilder join2 = null;
|
StringBuilder join2 = null;
|
||||||
if (join != null) {
|
if (join != null) {
|
||||||
@@ -2653,4 +2653,8 @@ public abstract class DataSqlSource<DBChannel> extends AbstractService implement
|
|||||||
}
|
}
|
||||||
return querySheetDB(info, readcache, needtotal, distinct, selects, flipper, node);
|
return querySheetDB(info, readcache, needtotal, distinct, selects, flipper, node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected static enum UpdateMode {
|
||||||
|
INSERT, DELETE, UPDATE, CLEAR, DROP, ALTER, OTHER;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public final class Redkale {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String getDotedVersion() {
|
public static String getDotedVersion() {
|
||||||
return "2.0.0-rc4";
|
return "2.0.0";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getMajorVersion() {
|
public static int getMajorVersion() {
|
||||||
|
|||||||
@@ -159,6 +159,20 @@ public abstract class TypeToken<T> {
|
|||||||
return atas[i];
|
return atas[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ParameterizedType cycType = superPT;
|
||||||
|
if (cycType.getRawType() instanceof Class) {
|
||||||
|
TypeVariable[] argTypes = ((Class) cycType.getRawType()).getTypeParameters();
|
||||||
|
if (argTypes.length == asts.length) {
|
||||||
|
for (int i = 0; i < argTypes.length; i++) {
|
||||||
|
if (argTypes[i] == type) {
|
||||||
|
if (atas[i] instanceof TypeVariable
|
||||||
|
&& ((TypeVariable) atas[i]).getBounds().length == 1
|
||||||
|
&& ((TypeVariable) atas[i]).getBounds()[0] instanceof Class)
|
||||||
|
return ((Class) ((TypeVariable) atas[i]).getBounds()[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Type moreType = ((ParameterizedType) superType).getRawType();
|
Type moreType = ((ParameterizedType) superType).getRawType();
|
||||||
if (moreType != Object.class) return getGenericType(type, moreType);
|
if (moreType != Object.class) return getGenericType(type, moreType);
|
||||||
|
|||||||
@@ -1516,6 +1516,28 @@ public final class Utility {
|
|||||||
+ today.getHour() * 100_00 + today.getMinute() * 100 + today.getSecond();
|
+ today.getHour() * 100_00 + today.getMinute() * 100 + today.getSecond();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取明天20151230格式的int值
|
||||||
|
*
|
||||||
|
* @return 20151230格式的int值
|
||||||
|
*/
|
||||||
|
public static int tomorrow() {
|
||||||
|
Calendar cal = Calendar.getInstance();
|
||||||
|
cal.add(Calendar.DAY_OF_YEAR, 1);
|
||||||
|
return cal.get(Calendar.YEAR) * 10000 + (cal.get(Calendar.MONTH) + 1) * 100 + cal.get(Calendar.DAY_OF_MONTH);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取明天151230格式的int值
|
||||||
|
*
|
||||||
|
* @return 151230格式的int值
|
||||||
|
*/
|
||||||
|
public static int tomorrowYYMMDD() {
|
||||||
|
Calendar cal = Calendar.getInstance();
|
||||||
|
cal.add(Calendar.DAY_OF_YEAR, 1);
|
||||||
|
return cal.get(Calendar.YEAR) % 100 * 10000 + (cal.get(Calendar.MONTH) + 1) * 100 + cal.get(Calendar.DAY_OF_MONTH);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取昨天20151230格式的int值
|
* 获取昨天20151230格式的int值
|
||||||
*
|
*
|
||||||
|
|||||||
15
test/org/redkale/test/type/OneBean.java
Normal file
15
test/org/redkale/test/type/OneBean.java
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package org.redkale.test.type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author zhangjx
|
||||||
|
*/
|
||||||
|
public class OneBean {
|
||||||
|
|
||||||
|
public int id;
|
||||||
|
}
|
||||||
14
test/org/redkale/test/type/OneRound.java
Normal file
14
test/org/redkale/test/type/OneRound.java
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package org.redkale.test.type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author zhangjx
|
||||||
|
*/
|
||||||
|
public class OneRound {
|
||||||
|
|
||||||
|
}
|
||||||
22
test/org/redkale/test/type/OneService.java
Normal file
22
test/org/redkale/test/type/OneService.java
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package org.redkale.test.type;
|
||||||
|
|
||||||
|
import org.redkale.service.RetResult;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author zhangjx
|
||||||
|
* @param <OR>
|
||||||
|
* @param <OB>
|
||||||
|
*/
|
||||||
|
public class OneService<OR extends OneRound, OB extends OneBean> {
|
||||||
|
|
||||||
|
public RetResult run(OR round, OB bean) {
|
||||||
|
return RetResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
15
test/org/redkale/test/type/ThreeBean.java
Normal file
15
test/org/redkale/test/type/ThreeBean.java
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package org.redkale.test.type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author zhangjx
|
||||||
|
*/
|
||||||
|
public class ThreeBean extends TwoBean {
|
||||||
|
|
||||||
|
public String desc;
|
||||||
|
}
|
||||||
14
test/org/redkale/test/type/ThreeRound.java
Normal file
14
test/org/redkale/test/type/ThreeRound.java
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package org.redkale.test.type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author zhangjx
|
||||||
|
*/
|
||||||
|
public class ThreeRound extends TwoRound {
|
||||||
|
|
||||||
|
}
|
||||||
20
test/org/redkale/test/type/ThreeService.java
Normal file
20
test/org/redkale/test/type/ThreeService.java
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package org.redkale.test.type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author zhangjx
|
||||||
|
* @param <K>
|
||||||
|
* @param <ER>
|
||||||
|
* @param <EB>
|
||||||
|
*/
|
||||||
|
public class ThreeService<K extends CharSequence, ER extends ThreeRound, EB extends ThreeBean> extends OneService<ER, EB> {
|
||||||
|
|
||||||
|
public String key(K key) {
|
||||||
|
return "" + key;
|
||||||
|
}
|
||||||
|
}
|
||||||
15
test/org/redkale/test/type/TwoBean.java
Normal file
15
test/org/redkale/test/type/TwoBean.java
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package org.redkale.test.type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author zhangjx
|
||||||
|
*/
|
||||||
|
public class TwoBean extends OneBean {
|
||||||
|
|
||||||
|
public String name;
|
||||||
|
}
|
||||||
14
test/org/redkale/test/type/TwoRound.java
Normal file
14
test/org/redkale/test/type/TwoRound.java
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package org.redkale.test.type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author zhangjx
|
||||||
|
*/
|
||||||
|
public class TwoRound extends OneRound {
|
||||||
|
|
||||||
|
}
|
||||||
16
test/org/redkale/test/type/TwoService.java
Normal file
16
test/org/redkale/test/type/TwoService.java
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package org.redkale.test.type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author zhangjx
|
||||||
|
* @param <TR>
|
||||||
|
* @param <TB>
|
||||||
|
*/
|
||||||
|
public class TwoService<TR extends TwoRound, TB extends TwoBean> extends OneService<TR, TB> {
|
||||||
|
|
||||||
|
}
|
||||||
32
test/org/redkale/test/type/TypeTokenTest.java
Normal file
32
test/org/redkale/test/type/TypeTokenTest.java
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package org.redkale.test.type;
|
||||||
|
|
||||||
|
import java.lang.reflect.*;
|
||||||
|
import org.redkale.util.TypeToken;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author zhangjx
|
||||||
|
*/
|
||||||
|
public class TypeTokenTest {
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Throwable {
|
||||||
|
Class declaringClass = ThreeService.class;
|
||||||
|
ParameterizedType declaringType = (ParameterizedType) declaringClass.getGenericSuperclass();
|
||||||
|
System.out.println("getRawType:" + declaringType.getRawType());
|
||||||
|
TypeVariable argType0 = (TypeVariable)declaringType.getActualTypeArguments()[0];
|
||||||
|
System.out.println("argType0.getBounds[0]:" + argType0.getBounds()[0]);
|
||||||
|
|
||||||
|
for (Method method : declaringClass.getMethods()) {
|
||||||
|
if (!"run".equals(method.getName())) continue;
|
||||||
|
System.out.println("返回值应该是: " + ThreeRound.class);
|
||||||
|
System.out.println("返回值结果是: " + TypeToken.getGenericType(method.getGenericParameterTypes()[0], declaringClass));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user