Examples of InvocationHandler


Examples of java.lang.reflect.InvocationHandler

            if (isInterface) {
                String impl = context.getGlobalContext().getBeanImplementationMap().get(clazz);

                if (impl == null) {
                    InvocationHandler handler = new InterfaceInvocationHandler();
                    object = Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[] {clazz},
                                                    handler);
                    target = handler;
                } else {
                    try {
View Full Code Here

Examples of java.lang.reflect.InvocationHandler

        } catch(IllegalArgumentException iae) {
            // expected
        }

        final List calledMethods = new ArrayList();
        final InvocationHandler handler = new MethodCallLogger(calledMethods) {
            public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
                Object o = super.invoke(proxy, method, args);
                if (o instanceof Integer) {
                    // so getNumActive/getNumIdle are not zero.
                    o = new Integer(1);
View Full Code Here

Examples of java.lang.reflect.InvocationHandler

        } catch(IllegalArgumentException iae) {
            // expected
        }

        final List calledMethods = new ArrayList();
        final InvocationHandler handler = new MethodCallLogger(calledMethods) {
            public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
                Object o = super.invoke(proxy, method, args);
                if (o instanceof Integer) {
                    // so getNumActive/getNumIdle are not zero.
                    o = new Integer(1);
View Full Code Here

Examples of java.lang.reflect.InvocationHandler

        } catch(IllegalArgumentException iae) {
            // expected
        }

        final List calledMethods = new ArrayList();
        final InvocationHandler handler = new MethodCallLogger(calledMethods) {
            public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
                Object o = super.invoke(proxy, method, args);
                if (o instanceof Integer) {
                    // so getNumActive/getNumIdle are not zero.
                    o = new Integer(1);
View Full Code Here

Examples of java.lang.reflect.InvocationHandler

     */
    @SuppressWarnings("unchecked")
    public A createAnnotation() {
        ClassLoader classLoader = SecureActions.getClassLoader(getType());
        Class<A> proxyClass = (Class<A>) Proxy.getProxyClass(classLoader, getType());
        InvocationHandler handler = new AnnotationProxy(this);
        try {
            return SecureActions.getConstructor(proxyClass, InvocationHandler.class)
                  .newInstance(handler);
        } catch (ValidationException e) {
            throw e;
View Full Code Here

Examples of java.lang.reflect.InvocationHandler

            // handle the deprecated sun case and other possible hidden API's
            // that are similar to the Sun cases
            try {
                Method method = connection.getClass().getMethod("getHostnameVerifier");
               
                InvocationHandler handler = new ReflectionInvokationHandler(verifier) {
                    public Object invoke(Object proxy,
                                         Method method,
                                         Object[] args) throws Throwable {
                        try {
                            return super.invoke(proxy, method, args);
View Full Code Here

Examples of java.lang.reflect.InvocationHandler

        assertEquals("Hello CXF", result);
    }

    @Test
    public void testProxy() throws Exception {
        InvocationHandler handler = new InvocationHandler() {

            public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
                // TODO Auto-generated method stub
                return null;
            }
View Full Code Here

Examples of java.lang.reflect.InvocationHandler

        }
        return createProxyWrapper(t, wr.value());
    }
   
    public static <T> T createProxyWrapper(Object target, Class<T> inf) {
        InvocationHandler h = new ReflectionInvokationHandler(target);
        return inf.cast(Proxy.newProxyInstance(inf.getClassLoader(), new Class[] {inf}, h));
    }
View Full Code Here

Examples of java.lang.reflect.InvocationHandler

                }
            }
            if (!isAdaptable) {
                result.addFailure(FailureType.ADAPTABLE_DOES_NOT_MATCH, type);
            } else if (type.isInterface()) {
                InvocationHandler handler = createInvocationHandler(adaptable, type, modelAnnotation, result);
                if (handler != null) {
                    ModelType model = (ModelType) Proxy.newProxyInstance(type.getClassLoader(), new Class<?>[] { type }, handler);
                    result.setModel(model);
                }
            } else {
View Full Code Here

Examples of java.lang.reflect.InvocationHandler

            }
        }

        final Context context = new Context.Builder().contextPath(config.mappingPath()).basePath(config.path()).build();
        ServletContext ctx = (ServletContext) Proxy.newProxyInstance(BridgeRuntime.class.getClassLoader(), new Class[]{ServletContext.class},
                new InvocationHandler() {
                    @Override
                    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
                        try {
                            Method stub = Context.class.getMethod(method.getName(), method.getParameterTypes());
                            if (stub != null) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.