Package net.sf.cglib.core

Examples of net.sf.cglib.core.Signature


/* 37 */     super.declare_field(access, name, type, value, attrs);
/*    */
/* 39 */     String property = TypeUtils.upperFirst(this.callback.getPropertyName(getClassType(), name));
/* 40 */     if (property != null)
/*    */     {
/* 42 */       CodeEmitter e = begin_method(1, new Signature("get" + property, type, Constants.TYPES_EMPTY), null, null);
/*    */
/* 48 */       e.load_this();
/* 49 */       e.getfield(name);
/* 50 */       e.return_value();
/* 51 */       e.end_method();
/*    */
/* 53 */       e = begin_method(1, new Signature("set" + property, Type.VOID_TYPE, new Type[] { type }), null, null);
/*    */
/* 59 */       e.load_this();
/* 60 */       e.load_arg(0);
/* 61 */       e.putfield(name);
/* 62 */       e.return_value();
View Full Code Here


/*    */     }
/*    */   }
/*    */
/*    */   private Signature loadMethod(int index)
/*    */   {
/* 83 */     return new Signature("CGLIB$LOAD_PRIVATE_" + index, Constants.TYPE_OBJECT, Constants.TYPES_EMPTY);
/*    */   }
View Full Code Here

/*     */   public void generateClass(ClassVisitor v) throws Exception {
/* 102 */     ClassEmitter ce = new ClassEmitter(v);
/* 103 */     ce.begin_class(46, 513, getClassName(), null, null, "<generated>");
/*     */
/* 109 */     for (Iterator it = this.signatures.keySet().iterator(); it.hasNext(); ) {
/* 110 */       Signature sig = (Signature)it.next();
/* 111 */       Type[] exceptions = (Type[])this.signatures.get(sig);
/* 112 */       ce.begin_method(1025, sig, exceptions, null).end_method();
/*     */     }
/*     */
/* 117 */     ce.end_class();
View Full Code Here

/*    */
/*    */   public void generate(ClassEmitter ce, CallbackGenerator.Context context, List methods)
/*    */   {
/* 37 */     for (Iterator it = methods.iterator(); it.hasNext(); ) {
/* 38 */       MethodInfo method = (MethodInfo)it.next();
/* 39 */       Signature impl = context.getImplSignature(method);
/* 40 */       ce.declare_field(26, impl.getName(), METHOD, null, null);
/*    */
/* 42 */       CodeEmitter e = context.beginMethod(ce, method);
/* 43 */       Block handler = e.begin_block();
/* 44 */       context.emitCallback(e, context.getIndex(method));
/* 45 */       e.load_this();
/* 46 */       e.getfield(impl.getName());
/* 47 */       e.create_arg_array();
/* 48 */       e.invoke_interface(INVOCATION_HANDLER, INVOKE);
/* 49 */       e.unbox(method.getSignature().getReturnType());
/* 50 */       e.return_value();
/* 51 */       handler.end();
View Full Code Here

        this.methodName = methodName;
        this.methodDesc = methodDesc;
    }

    public Signature getSignature() {
        return new Signature(methodName, methodDesc);
    }
View Full Code Here

        this.handlerInfoChainFactory = new HandlerInfoChainFactory(handlerInfos);
        sortedOperationInfos = new OperationInfo[FastClass.create(serviceEndpointClass).getMaxIndex() + 1];
        String encodingStyle = "";
        for (int i = 0; i < operationInfos.length; i++) {
            OperationInfo operationInfo = operationInfos[i];
            Signature signature = operationInfo.getSignature();
            MethodProxy methodProxy = MethodProxy.find(serviceEndpointClass, signature);
            if (methodProxy == null) {
                throw new RuntimeException("No method proxy for operationInfo " + signature);
            }
            int index = methodProxy.getSuperIndex();
View Full Code Here

        }
        return null;
    }

    private static int getSuperIndex(Class proxyType, Method method) {
        Signature signature = new Signature(method.getName(), Type.getReturnType(method), Type.getArgumentTypes(method));
        MethodProxy methodProxy = MethodProxy.find(proxyType, signature);
        if (methodProxy != null) {
            return methodProxy.getSuperIndex();
        }
        return -1;
View Full Code Here

                String signature, String superName, String[] interfaces) {
        }

        public MethodVisitor visitMethod(int access, String name, String desc,
                String signature, String[] exceptions) {
            Signature sig = new Signature(name, desc);
            if (eligableMethods.remove(sig)) {
                currentMethod = sig;
                return new MethodVisitor(Opcodes.ASM4) {
                    public void visitMethodInsn(int opcode, String owner, String name,
                                                String desc) {
                        if (opcode == Opcodes.INVOKESPECIAL && currentMethod != null) {
                            Signature target = new Signature(name, desc);
                            // If the target signature is the same as the current,
                            // we shouldn't change our bridge becaues invokespecial
                            // is the only way to make progress (otherwise we'll
                            // get infinite recursion).  This would typically
                            // only happen when a bridge method is created to widen
                            // the visibility of a superclass' method.
                            if (!target.equals(currentMethod)) {
                                resolved.put(currentMethod, target);
                            }
                            currentMethod = null;
                        }
                    }
View Full Code Here

/*     */
/*     */   public void generate(ClassEmitter ce, CallbackGenerator.Context context, List methods) {
/*  73 */     Map sigMap = new HashMap();
/*  74 */     for (Iterator it = methods.iterator(); it.hasNext(); ) {
/*  75 */       MethodInfo method = (MethodInfo)it.next();
/*  76 */       Signature impl = context.getImplSignature(method);
/*     */
/*  78 */       String methodField = getMethodField(impl);
/*  79 */       String methodProxyField = getMethodProxyField(impl);
/*     */
/*  81 */       sigMap.put(method.getSignature().toString(), methodProxyField);
View Full Code Here

/* 152 */     e.putfield("CGLIB$emptyArgs");
/*     */
/* 154 */     for (Iterator it = methods.iterator(); it.hasNext(); ) {
/* 155 */       e.dup();
/* 156 */       MethodInfo method = (MethodInfo)it.next();
/* 157 */       Signature impl = context.getImplSignature(method);
/* 158 */       EmitUtils.load_method(e, method);
/* 159 */       e.dup();
/* 160 */       e.putfield(getMethodField(impl));
/*     */
/* 162 */       Signature sig = method.getSignature();
/* 163 */       e.invoke_virtual(METHOD, GET_DECLARING_CLASS);
/* 164 */       e.load_local(thisclass);
/* 165 */       e.push(sig.getDescriptor());
/* 166 */       e.push(sig.getName());
/* 167 */       e.push(impl.getName());
/* 168 */       e.invoke_static(METHOD_PROXY, MAKE_PROXY);
/* 169 */       e.putfield(getMethodProxyField(impl));
/*     */     }
/*     */   }
View Full Code Here

TOP

Related Classes of net.sf.cglib.core.Signature

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.