本文整理汇总了Java中org.codehaus.groovy.runtime.wrappers.Wrapper类的典型用法代码示例。如果您正苦于以下问题:Java Wrapper类的具体用法?Java Wrapper怎么用?Java Wrapper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Wrapper类属于org.codehaus.groovy.runtime.wrappers包,在下文中一共展示了Wrapper类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getClassWithNullAndWrapper
import org.codehaus.groovy.runtime.wrappers.Wrapper; //导入依赖的package包/类
private static Class getClassWithNullAndWrapper(Object arg) {
if (arg == null) return null;
if (arg instanceof Wrapper) {
Wrapper w = (Wrapper) arg;
return w.getType();
}
return arg.getClass();
}
示例2: unwrap
import org.codehaus.groovy.runtime.wrappers.Wrapper; //导入依赖的package包/类
public static void unwrap(Object[] arguments) {
//
// Temp code to ignore wrapped parameters
// The New MOP will deal with these properly
//
for (int i = 0; i != arguments.length; i++) {
if (arguments[i] instanceof Wrapper) {
arguments[i] = ((Wrapper) arguments[i]).unwrap();
}
}
}
示例3: getArgClass
import org.codehaus.groovy.runtime.wrappers.Wrapper; //导入依赖的package包/类
private static Class getArgClass(Object arg) {
Class cls;
if (arg == null) {
cls = null;
} else {
if (arg instanceof Wrapper) {
cls = ((Wrapper) arg).getType();
} else
cls = arg.getClass();
}
return cls;
}
示例4: makeIndyCall
import org.codehaus.groovy.runtime.wrappers.Wrapper; //导入依赖的package包/类
private void makeIndyCall(MethodCallerMultiAdapter adapter, Expression receiver, boolean implicitThis, boolean safe, String methodName, Expression arguments) {
OperandStack operandStack = controller.getOperandStack();
StringBuilder sig = new StringBuilder(prepareIndyCall(receiver, implicitThis));
// load arguments
int numberOfArguments = 1;
ArgumentListExpression ae = makeArgumentList(arguments);
boolean containsSpreadExpression = AsmClassGenerator.containsSpreadExpression(arguments);
if (containsSpreadExpression) {
controller.getAcg().despreadList(ae.getExpressions(), true);
sig.append(getTypeDescription(Object[].class));
} else {
for (Expression arg : ae.getExpressions()) {
arg.visit(controller.getAcg());
if (arg instanceof CastExpression) {
operandStack.box();
controller.getAcg().loadWrapper(arg);
sig.append(getTypeDescription(Wrapper.class));
} else {
sig.append(getTypeDescription(operandStack.getTopOperand()));
}
numberOfArguments++;
}
}
sig.append(")Ljava/lang/Object;");
String callSiteName = METHOD.getCallSiteName();
if (adapter==null) callSiteName = INIT.getCallSiteName();
int flags = getMethodCallFlags(adapter, safe, containsSpreadExpression);
finishIndyCall(BSM, callSiteName, sig.toString(), numberOfArguments, methodName, flags);
}
示例5: unwrap
import org.codehaus.groovy.runtime.wrappers.Wrapper; //导入依赖的package包/类
private static void unwrap(Object[] arguments) {
for (int i = 0; i != arguments.length; i++) {
if (arguments[i] instanceof Wrapper) {
arguments[i] = ((Wrapper) arguments[i]).unwrap();
}
}
}
示例6: removeWrapper
import org.codehaus.groovy.runtime.wrappers.Wrapper; //导入依赖的package包/类
/**
* Helper method to manipulate the given type to replace Wrapper with Object.
*/
private MethodType removeWrapper(MethodType targetType) {
Class[] types = targetType.parameterArray();
for (int i=0; i<types.length; i++) {
if (types[i]==Wrapper.class) {
targetType = targetType.changeParameterType(i, Object.class);
}
}
return targetType;
}
示例7: noWrappers
import org.codehaus.groovy.runtime.wrappers.Wrapper; //导入依赖的package包/类
static boolean noWrappers(Object[] args) {
for (int i = 0; i != args.length; ++i)
if (args[i] instanceof Wrapper)
return false;
return true;
}
示例8: createPojoWrapper
import org.codehaus.groovy.runtime.wrappers.Wrapper; //导入依赖的package包/类
public static Wrapper createPojoWrapper(Object val, Class clazz) {
return new PojoWrapper(val, clazz);
}
示例9: createGroovyObjectWrapper
import org.codehaus.groovy.runtime.wrappers.Wrapper; //导入依赖的package包/类
public static Wrapper createGroovyObjectWrapper(GroovyObject val, Class clazz) {
return new GroovyObjectWrapper(val, clazz);
}
示例10: unwrapIfWrapped
import org.codehaus.groovy.runtime.wrappers.Wrapper; //导入依赖的package包/类
/**
* Unwraps the given object from a {@link Wrapper}. If not
* wrapped, the given object is returned.
*/
private static Object unwrapIfWrapped(Object object) {
if (object instanceof Wrapper) return unwrap(object);
return object;
}
示例11: unwrap
import org.codehaus.groovy.runtime.wrappers.Wrapper; //导入依赖的package包/类
/**
* Unwraps a {@link Wrapper}.
* This method is called by the handle to unwrap a Wrapper, which
* we use to force method selection.
*/
public static Object unwrap(Object o) {
Wrapper w = (Wrapper) o;
return w.unwrap();
}