This commit is contained in:
@@ -20,7 +20,7 @@ import org.redkale.net.*;
|
|||||||
import static org.redkale.net.sncp.SncpRequest.*;
|
import static org.redkale.net.sncp.SncpRequest.*;
|
||||||
import org.redkale.service.*;
|
import org.redkale.service.*;
|
||||||
import org.redkale.util.*;
|
import org.redkale.util.*;
|
||||||
import org.redkale.service.DynCall;
|
import org.redkale.service.RpcCall;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -41,7 +41,7 @@ public final class SncpClient {
|
|||||||
|
|
||||||
protected final Type[] paramTypes;
|
protected final Type[] paramTypes;
|
||||||
|
|
||||||
protected final Attribute[] paramAttrs; // 为null表示无DynCall处理,index=0固定为null, 其他为参数标记的DynCall回调方法
|
protected final Attribute[] paramAttrs; // 为null表示无RpcCall处理,index=0固定为null, 其他为参数标记的RpcCall回调方法
|
||||||
|
|
||||||
protected final int addressTargetParamIndex;
|
protected final int addressTargetParamIndex;
|
||||||
|
|
||||||
@@ -76,12 +76,12 @@ public final class SncpClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Annotation ann : anns[i]) {
|
for (Annotation ann : anns[i]) {
|
||||||
if (ann.annotationType() == DynCall.class) {
|
if (ann.annotationType() == RpcCall.class) {
|
||||||
try {
|
try {
|
||||||
atts[i + 1] = ((DynCall) ann).value().newInstance();
|
atts[i + 1] = ((RpcCall) ann).value().newInstance();
|
||||||
hasattr = true;
|
hasattr = true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.log(Level.SEVERE, DynCall.class.getSimpleName() + ".attribute cannot a newInstance for" + method, e);
|
logger.log(Level.SEVERE, RpcCall.class.getSimpleName() + ".attribute cannot a newInstance for" + method, e);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import jdk.internal.org.objectweb.asm.Type;
|
|||||||
import org.redkale.convert.bson.*;
|
import org.redkale.convert.bson.*;
|
||||||
import org.redkale.service.*;
|
import org.redkale.service.*;
|
||||||
import org.redkale.util.*;
|
import org.redkale.util.*;
|
||||||
import org.redkale.service.DynCall;
|
import org.redkale.service.RpcCall;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -141,7 +141,7 @@ public final class SncpDynServlet extends SncpServlet {
|
|||||||
@Resource
|
@Resource
|
||||||
protected BsonConvert convert;
|
protected BsonConvert convert;
|
||||||
|
|
||||||
protected org.redkale.util.Attribute[] paramAttrs; // 为null表示无DynCall处理,index=0固定为null, 其他为参数标记的DynCall回调方法
|
protected org.redkale.util.Attribute[] paramAttrs; // 为null表示无RpcCall处理,index=0固定为null, 其他为参数标记的RpcCall回调方法
|
||||||
|
|
||||||
protected java.lang.reflect.Type[] paramTypes; //index=0表示返回参数的type, void的返回参数类型为null
|
protected java.lang.reflect.Type[] paramTypes; //index=0表示返回参数的type, void的返回参数类型为null
|
||||||
|
|
||||||
@@ -405,12 +405,12 @@ public final class SncpDynServlet extends SncpServlet {
|
|||||||
for (int i = 0; i < anns.length; i++) {
|
for (int i = 0; i < anns.length; i++) {
|
||||||
if (anns[i].length > 0) {
|
if (anns[i].length > 0) {
|
||||||
for (Annotation ann : anns[i]) {
|
for (Annotation ann : anns[i]) {
|
||||||
if (ann.annotationType() == DynCall.class) {
|
if (ann.annotationType() == RpcCall.class) {
|
||||||
try {
|
try {
|
||||||
atts[i + 1] = ((DynCall) ann).value().newInstance();
|
atts[i + 1] = ((RpcCall) ann).value().newInstance();
|
||||||
hasattr = true;
|
hasattr = true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.log(Level.SEVERE, DynCall.class.getSimpleName() + ".attribute cannot a newInstance for" + method, e);
|
logger.log(Level.SEVERE, RpcCall.class.getSimpleName() + ".attribute cannot a newInstance for" + method, e);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public class DataSourceService implements DataSource, Service, AutoCloseable {
|
|||||||
private DataSource source;
|
private DataSource source;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> void insert(@DynCall(DataCallArrayAttribute.class) T... values) {
|
public <T> void insert(@RpcCall(DataCallArrayAttribute.class) T... values) {
|
||||||
source.insert(values);
|
source.insert(values);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
|||||||
import org.redkale.util.*;
|
import org.redkale.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 参数回写, 当Service的方法需要更改参数对象内部的数据时,需要使用DynCall
|
* 参数回写, 当Service的方法需要更改参数对象内部的数据时,需要使用RpcCall
|
||||||
*
|
*
|
||||||
* <p> 详情见: http://redkale.org
|
* <p> 详情见: http://redkale.org
|
||||||
* @author zhangjx
|
* @author zhangjx
|
||||||
@@ -19,7 +19,7 @@ import org.redkale.util.*;
|
|||||||
@Documented
|
@Documented
|
||||||
@Target({ElementType.PARAMETER})
|
@Target({ElementType.PARAMETER})
|
||||||
@Retention(RUNTIME)
|
@Retention(RUNTIME)
|
||||||
public @interface DynCall {
|
public @interface RpcCall {
|
||||||
|
|
||||||
Class<? extends Attribute> value();
|
Class<? extends Attribute> value();
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user