Search in sources :

Example 1 with Signature

use of net.sf.cglib.core.Signature in project cglib by cglib.

the class MethodProxy method create.

/**
     * For internal use by {@link Enhancer} only; see the {@link net.sf.cglib.reflect.FastMethod} class
     * for similar functionality.
     */
public static MethodProxy create(Class c1, Class c2, String desc, String name1, String name2) {
    MethodProxy proxy = new MethodProxy();
    proxy.sig1 = new Signature(name1, desc);
    proxy.sig2 = new Signature(name2, desc);
    proxy.createInfo = new CreateInfo(c1, c2);
    return proxy;
}
Also used : Signature(net.sf.cglib.core.Signature)

Example 2 with Signature

use of net.sf.cglib.core.Signature in project blade by biezhi.

the class FastMethod method helper.

private static int helper(FastClass fc, Method method) {
    int index = fc.getIndex(new Signature(method.getName(), Type.getMethodDescriptor(method)));
    if (index < 0) {
        Class[] types = method.getParameterTypes();
        System.err.println("hash=" + method.getName().hashCode() + " size=" + types.length);
        for (int i = 0; i < types.length; i++) {
            System.err.println("  types[" + i + "]=" + types[i].getName());
        }
        throw new IllegalArgumentException("Cannot find method " + method);
    }
    return index;
}
Also used : Signature(net.sf.cglib.core.Signature)

Example 3 with Signature

use of net.sf.cglib.core.Signature in project tomee by apache.

the class SeiFactoryImpl method initialize.

void initialize(Object serviceImpl, ClassLoader classLoader) throws ClassNotFoundException {
    this.serviceImpl = serviceImpl;
    Class serviceEndpointBaseClass = classLoader.loadClass(serviceEndpointClassName);
    serviceEndpointClass = enhanceServiceEndpointInterface(serviceEndpointBaseClass, classLoader);
    Class[] constructorTypes = new Class[] { classLoader.loadClass(GenericServiceEndpoint.class.getName()) };
    this.constructor = FastClass.create(serviceEndpointClass).getConstructor(constructorTypes);
    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 ServerRuntimeException("No method proxy for operationInfo " + signature);
        }
        int index = methodProxy.getSuperIndex();
        sortedOperationInfos[index] = operationInfo;
        if (operationInfo.getOperationDesc().getUse() == Use.ENCODED) {
            encodingStyle = org.apache.axis.Constants.URI_SOAP11_ENC;
        }
    }
    //register our type descriptors
    Service service = ((ServiceImpl) serviceImpl).getService();
    AxisEngine axisEngine = service.getEngine();
    TypeMappingRegistry typeMappingRegistry = axisEngine.getTypeMappingRegistry();
    TypeMapping typeMapping = typeMappingRegistry.getOrMakeTypeMapping(encodingStyle);
    typeMapping.register(BigInteger.class, Constants.XSD_UNSIGNEDLONG, new SimpleSerializerFactory(BigInteger.class, Constants.XSD_UNSIGNEDLONG), new SimpleDeserializerFactory(BigInteger.class, Constants.XSD_UNSIGNEDLONG));
    typeMapping.register(URI.class, Constants.XSD_ANYURI, new SimpleSerializerFactory(URI.class, Constants.XSD_ANYURI), new SimpleDeserializerFactory(URI.class, Constants.XSD_ANYURI));
    //It is essential that the types be registered before the typeInfos create the serializer/deserializers.
    for (Iterator iter = typeInfo.iterator(); iter.hasNext(); ) {
        TypeInfo info = (TypeInfo) iter.next();
        TypeDesc.registerTypeDescForClass(info.getClazz(), info.buildTypeDesc());
    }
    TypeInfo.register(typeInfo, typeMapping);
}
Also used : SimpleSerializerFactory(org.apache.axis.encoding.ser.SimpleSerializerFactory) HandlerInfoChainFactory(org.apache.axis.handlers.HandlerInfoChainFactory) Service(org.apache.axis.client.Service) URI(java.net.URI) SimpleDeserializerFactory(org.apache.axis.encoding.ser.SimpleDeserializerFactory) Signature(net.sf.cglib.core.Signature) MethodProxy(net.sf.cglib.proxy.MethodProxy) Iterator(java.util.Iterator) TypeMappingRegistry(org.apache.axis.encoding.TypeMappingRegistry) TypeMapping(org.apache.axis.encoding.TypeMapping) BigInteger(java.math.BigInteger) FastClass(net.sf.cglib.reflect.FastClass) ServerRuntimeException(org.apache.openejb.server.ServerRuntimeException) AxisEngine(org.apache.axis.AxisEngine)

Example 4 with Signature

use of net.sf.cglib.core.Signature in project simplejpa by appoxy.

the class LazyInterceptor method handleSetMethod.

private void handleSetMethod(Object obj, Method method, Object[] args) throws Throwable {
    // we basically want to mark this object as dirty if this is called and to only delete attributes if it's dirty
    dirty = true;
    String attributeName = NamingHelper.attributeName(method);
    if (args != null && args.length == 1) {
        Object valueToSet = args[0];
        if (valueToSet == null) {
            // FIXME support direct field accessors better here
            PersistentMethod persistentMethod = (PersistentMethod) (PersistentMethod) em.getFactory().getAnnotationManager().getAnnotationInfo(obj).getPersistentProperty(attributeName);
            Method getter = persistentMethod.getGetter();
            MethodProxy getterProxy = MethodProxy.find(obj.getClass(), new Signature(persistentMethod.getGetter().getName(), Type.getType(getter.getReturnType()), new Type[] {}));
            Object ret = getterProxy.invokeSuper(obj, null);
            if (ret != null) {
                nulledFields.put(attributeName, ret);
                logger.fine("field " + attributeName + " is being nulled. Old value = " + ret);
            }
        }
    }
}
Also used : Type(net.sf.cglib.asm.Type) Signature(net.sf.cglib.core.Signature) MethodProxy(net.sf.cglib.proxy.MethodProxy) Method(java.lang.reflect.Method)

Example 5 with Signature

use of net.sf.cglib.core.Signature in project blade by biezhi.

the class MethodProxy method create.

/**
     * For internal use by {@link Enhancer} only; see the {@link net.sf.cglib.reflect.FastMethod} class
     * for similar functionality.
     */
public static MethodProxy create(Class c1, Class c2, String desc, String name1, String name2) {
    MethodProxy proxy = new MethodProxy();
    proxy.sig1 = new Signature(name1, desc);
    proxy.sig2 = new Signature(name2, desc);
    proxy.createInfo = new CreateInfo(c1, c2);
    return proxy;
}
Also used : Signature(net.sf.cglib.core.Signature)

Aggregations

Signature (net.sf.cglib.core.Signature)6 MethodProxy (net.sf.cglib.proxy.MethodProxy)2 Method (java.lang.reflect.Method)1 BigInteger (java.math.BigInteger)1 URI (java.net.URI)1 Iterator (java.util.Iterator)1 Type (net.sf.cglib.asm.Type)1 FastClass (net.sf.cglib.reflect.FastClass)1 AxisEngine (org.apache.axis.AxisEngine)1 Service (org.apache.axis.client.Service)1 TypeMapping (org.apache.axis.encoding.TypeMapping)1 TypeMappingRegistry (org.apache.axis.encoding.TypeMappingRegistry)1 SimpleDeserializerFactory (org.apache.axis.encoding.ser.SimpleDeserializerFactory)1 SimpleSerializerFactory (org.apache.axis.encoding.ser.SimpleSerializerFactory)1 HandlerInfoChainFactory (org.apache.axis.handlers.HandlerInfoChainFactory)1 ServerRuntimeException (org.apache.openejb.server.ServerRuntimeException)1