Package ch.softappeal.yass.core

Examples of ch.softappeal.yass.core.Interceptor


          } catch (final InvocationTargetException e) {
            throw e.getCause();
          }
        }
      };
      final Interceptor interceptor = Interceptors.composite(invocationInterceptor, serviceInterceptor);
      @Nullable final Object value;
      try {
        value = interceptor.invoke(method, arguments, invocation);
      } catch (final Throwable t) {
        return new ExceptionReply(t);
      }
      return new ValueReply(value);
    }
View Full Code Here


  public final <C> Invoker<C> invoker(final ContractId<C> contractId) {
    final MethodMapper methodMapper = methodMapper(contractId.contract);
    return new Invoker<C>() {
      @Override public C proxy(final Interceptor... interceptors) {
        final Interceptor interceptor = Interceptors.composite(interceptors);
        return contractId.contract.cast(Proxy.newProxyInstance(contractId.contract.getClassLoader(), new Class<?>[] {contractId.contract}, new InvocationHandler() {
          @Override public Object invoke(final Object proxy, final Method method, final Object[] arguments) throws Throwable {
            return Client.this.invoke(new ClientInvocation(interceptor, contractId.id, methodMapper.mapMethod(method), arguments));
          }
        }));
View Full Code Here

            throw e.getCause();
          }
        }
      };
      invocation.context = request.context;
      final Interceptor interceptor = Interceptors.composite(invokerInterceptor, serviceInterceptor);
      @Nullable final Object value;
      try {
        value = interceptor.invoke(invocation);
      } catch (final Throwable t) {
        return new ExceptionReply(invocation.context, t);
      }
      return new ValueReply(invocation.context, value);
    }
View Full Code Here

  }


  final <C> Invoker<C> invoker(final ContractId<C> contractId) {
    final MethodMapper methodMapper = methodMapper(contractId.contract);
    final Interceptor invokerInterceptor = Interceptors.threadLocal(ContractId.INSTANCE, contractId);
    return new Invoker<C>() {
      @Override public C proxy(final Interceptor... interceptors) {
        final Interceptor interceptor = Interceptors.composite(invokerInterceptor, Interceptors.composite(interceptors));
        return contractId.contract.cast(Proxy.newProxyInstance(contractId.contract.getClassLoader(), new Class<?>[] {contractId.contract}, new InvocationHandler() {
          @Override public Object invoke(final Object proxy, final Method method, final Object[] arguments) throws Throwable {
            return Client.this.invoke(new ClientInvocation(interceptor, contractId.id, methodMapper.mapMethod(method), arguments));
          }
        }));
View Full Code Here

   */
  final <C> Invoker<C> invoker(final ContractId<C> contractId) {
    final MethodMapper methodMapper = methodMapper(contractId.contract);
    return new Invoker<C>() {
      @Override public C proxy(final Interceptor... interceptors) {
        final Interceptor interceptor = Interceptors.composite(contractId.interceptor, Interceptors.composite(interceptors));
        return contractId.contract.cast(Proxy.newProxyInstance(contractId.contract.getClassLoader(), new Class<?>[] {contractId.contract}, new InvocationHandler() {
          @Override public Object invoke(final Object proxy, final Method method, final Object[] arguments) throws Throwable {
            return Client.this.invoke(new ClientInvocation(interceptor, contractId.id, methodMapper.mapMethod(method), arguments));
          }
        }));
View Full Code Here

          } catch (final InvocationTargetException e) {
            throw e.getCause();
          }
        }
      };
      final Interceptor interceptor = Interceptors.composite(invocationInterceptor, invokerInterceptor);
      @Nullable final Object value;
      try {
        value = interceptor.invoke(method, arguments, invocation);
      } catch (final Throwable t) {
        return new ExceptionReply(t);
      }
      return new ValueReply(value);
    }
View Full Code Here

  final <C> Invoker<C> invoker(final ContractId<C> contractId) {
    final MethodMapper methodMapper = methodMapper(contractId.contract);
    return new Invoker<C>() {
      @Override public C proxy(final Interceptor... interceptors) {
        final Interceptor interceptor = Interceptors.composite(contractId.interceptor, Interceptors.composite(interceptors));
        return contractId.contract.cast(Proxy.newProxyInstance(contractId.contract.getClassLoader(), new Class<?>[] {contractId.contract}, new InvocationHandler() {
          @Override public Object invoke(final Object proxy, final Method method, final Object[] arguments) throws Throwable {
            return Client.this.invoke(new ClientInvocation(interceptor, contractId.id, methodMapper.mapMethod(method), arguments));
          }
        }));
View Full Code Here

          } catch (final InvocationTargetException e) {
            throw e.getCause();
          }
        }
      };
      final Interceptor interceptor = Interceptors.composite(invocationInterceptor, invokerInterceptor);
      @Nullable final Object value;
      try {
        value = interceptor.invoke(method, arguments, invocation);
      } catch (final Throwable t) {
        return new ExceptionReply(t);
      }
      return new ValueReply(value);
    }
View Full Code Here

   */
  final <C> Invoker<C> invoker(final ContractId<C> contractId) {
    final MethodMapper methodMapper = methodMapper(contractId.contract);
    return new Invoker<C>() {
      @Override public C proxy(final Interceptor... interceptors) {
        final Interceptor interceptor = Interceptors.composite(contractId.interceptor, Interceptors.composite(interceptors));
        return contractId.contract.cast(Proxy.newProxyInstance(contractId.contract.getClassLoader(), new Class<?>[] {contractId.contract}, new InvocationHandler() {
          @Override public Object invoke(final Object proxy, final Method method, final Object[] arguments) throws Throwable {
            return Client.this.invoke(new ClientInvocation(interceptor, contractId.id, methodMapper.mapMethod(method), arguments));
          }
        }));
View Full Code Here

  }


  final <C> Invoker<C> invoker(final ContractId<C> contractId) {
    final MethodMapper mapper = methodMapper(contractId.contract);
    final Interceptor invokerInterceptor = Interceptors.threadLocal(ContractId.INSTANCE, contractId);
    return new Invoker<C>() {
      @Override public C proxy(final Interceptor... interceptors) {
        final Interceptor interceptor = Interceptors.composite(invokerInterceptor, Interceptors.composite(interceptors));
        return contractId.contract.cast(Proxy.newProxyInstance(contractId.contract.getClassLoader(), new Class<?>[] {contractId.contract}, new InvocationHandler() {
          @Override public Object invoke(final Object proxy, final Method method, final Object[] arguments) throws Throwable {
            return Client.this.invoke(new ClientInvocation(interceptor, contractId.id, mapper.mapMethod(method), arguments));
          }
        }));
View Full Code Here

TOP

Related Classes of ch.softappeal.yass.core.Interceptor

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.