12 Commits

Author SHA1 Message Date
Redkale
51c50415e1 Redkale 2.0.0 正式版 结束 2020-04-08 13:24:51 +08:00
Redkale
2f08fa6476 2020-04-03 15:10:57 +08:00
Redkale
3091972fc5 2020-04-02 17:28:58 +08:00
Redkale
8e14df9a95 2020-04-01 13:33:43 +08:00
Redkale
683cec6f4d 2020-04-01 13:33:04 +08:00
Redkale
ec6e5aa3b1 2020-02-24 07:49:34 +08:00
Redkale
f4c00a9b6f 2020-02-12 11:43:13 +08:00
Redkale
c071ec5d6c 2020-02-09 12:37:40 +08:00
Redkale
29148c4b42 TypeToken.getGenericType加强 2020-02-09 12:37:00 +08:00
Redkale
7340caa4a9 2020-02-09 11:35:07 +08:00
Redkale
7d23dfa73d 2020-02-09 11:34:04 +08:00
Redkale
19932820a9 2020-02-06 16:28:48 +08:00
16 changed files with 235 additions and 5 deletions

View File

@@ -207,7 +207,9 @@ public final class ClassFilter<T> {
} catch (Throwable cfe) {
if (finest && !clazzname.startsWith("sun.") && !clazzname.startsWith("javax.")
&& !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);
}
}

View File

@@ -560,6 +560,17 @@ public abstract class WebSocket<G extends Serializable, T> {
return _engine.node.forceCloseWebSocket(userid);
}
/**
* 获取WebSocketNode
*
*
* @return WebSocketNode
*/
@Comment("获取WebSocketNode")
public final WebSocketNode webSocketNode() {
return _engine.node;
}
/**
* 获取当前WebSocket下的属性非线程安全
*

View File

@@ -1050,9 +1050,9 @@ public abstract class DataSqlSource<DBChannel> extends AbstractService implement
}
}
if (setsql.length() < 1) return CompletableFuture.completedFuture(0);
Map<Class, String> joinTabalis = node.getJoinTabalis();
CharSequence join = node.createSQLJoin(this, true, joinTabalis, new HashSet<>(), info);
CharSequence where = node.createSQLExpress(info, joinTabalis);
Map<Class, String> joinTabalis = node == null ? null : node.getJoinTabalis();
CharSequence join = node == null ? null : node.createSQLJoin(this, true, joinTabalis, new HashSet<>(), info);
CharSequence where = node == null ? null : node.createSQLExpress(info, joinTabalis);
StringBuilder join1 = null;
StringBuilder join2 = 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);
}
protected static enum UpdateMode {
INSERT, DELETE, UPDATE, CLEAR, DROP, ALTER, OTHER;
}
}

View File

@@ -17,7 +17,7 @@ public final class Redkale {
}
public static String getDotedVersion() {
return "2.0.0-rc4";
return "2.0.0";
}
public static int getMajorVersion() {

View File

@@ -159,6 +159,20 @@ public abstract class TypeToken<T> {
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();
if (moreType != Object.class) return getGenericType(type, moreType);

View File

@@ -1516,6 +1516,28 @@ public final class Utility {
+ 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值
*

View 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;
}

View 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 {
}

View 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();
}
}

View 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;
}

View 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 {
}

View 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;
}
}

View 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;
}

View 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 {
}

View 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> {
}

View 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;
}
}
}