Package com.kurento.tool.rom.client

Source Code of com.kurento.tool.rom.client.FactoryInvocationHandler

package com.kurento.tool.rom.client;

import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

import com.kurento.kmf.jsonrpcconnector.Props;
import com.kurento.tool.rom.ParamAnnotationUtils;

public class FactoryInvocationHandler extends DefaultInvocationHandler {

  private final Class<?> clazz;
  private final RemoteObjectFactory factory;

  public FactoryInvocationHandler(Class<?> clazz, RemoteObjectFactory factory) {
    super();
    this.clazz = clazz;
    this.factory = factory;
  }

  @Override
  public Object internalInvoke(Object proxy, Method method, Object[] args)
      throws Throwable {

    Props props = ParamAnnotationUtils.extractProps(
        method.getParameterAnnotations(), args);

    return Proxy.newProxyInstance(proxy.getClass().getClassLoader(),
        new Class[] { method.getReturnType() },
        new BuilderInvocationHandler(clazz, props, factory));
  }
}
TOP

Related Classes of com.kurento.tool.rom.client.FactoryInvocationHandler

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.