当前位置: 首页>>代码示例>>Java>>正文


Java Wrapper类代码示例

本文整理汇总了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();
}
 
开发者ID:yajsw,项目名称:yajsw,代码行数:9,代码来源:MetaClassHelper.java

示例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();
        }
    }
}
 
开发者ID:yajsw,项目名称:yajsw,代码行数:12,代码来源:MetaClassHelper.java

示例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;
}
 
开发者ID:apache,项目名称:groovy,代码行数:13,代码来源:ParameterTypes.java

示例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);
}
 
开发者ID:apache,项目名称:groovy,代码行数:33,代码来源:InvokeDynamicWriter.java

示例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();
        }
    }
}
 
开发者ID:apache,项目名称:groovy,代码行数:8,代码来源:ClosureMetaClass.java

示例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;
}
 
开发者ID:apache,项目名称:groovy,代码行数:13,代码来源:Selector.java

示例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;
}
 
开发者ID:apache,项目名称:groovy,代码行数:7,代码来源:AbstractCallSite.java

示例8: createPojoWrapper

import org.codehaus.groovy.runtime.wrappers.Wrapper; //导入依赖的package包/类
public static Wrapper createPojoWrapper(Object val, Class clazz) {
    return new PojoWrapper(val, clazz);
}
 
开发者ID:apache,项目名称:groovy,代码行数:4,代码来源:ScriptBytecodeAdapter.java

示例9: createGroovyObjectWrapper

import org.codehaus.groovy.runtime.wrappers.Wrapper; //导入依赖的package包/类
public static Wrapper createGroovyObjectWrapper(GroovyObject val, Class clazz) {
    return new GroovyObjectWrapper(val, clazz);
}
 
开发者ID:apache,项目名称:groovy,代码行数:4,代码来源:ScriptBytecodeAdapter.java

示例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;
}
 
开发者ID:apache,项目名称:groovy,代码行数:9,代码来源:Selector.java

示例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();
}
 
开发者ID:apache,项目名称:groovy,代码行数:10,代码来源:IndyGuardsFiltersAndSignatures.java


注:本文中的org.codehaus.groovy.runtime.wrappers.Wrapper类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。