Package openperipheral.adapter.peripheral

Examples of openperipheral.adapter.peripheral.AdapterPeripheral


  public static IPeripheral createAdaptedPeripheral(Object target) {
    Class<?> targetClass = target.getClass();
    ClassMethodsList<IPeripheralMethodExecutor> methods = AdapterManager.peripherals.getAdapterClass(targetClass);

    ProxyInterfaces proxyAnn = targetClass.getAnnotation(ProxyInterfaces.class);
    if (proxyAnn == null) return new AdapterPeripheral(methods, target);

    Set<Class<?>> implemented = ReflectionHelper.getAllInterfaces(targetClass);
    Set<Class<?>> blacklist = ImmutableSet.copyOf(proxyAnn.exclude());
    Set<Class<?>> proxied = Sets.difference(implemented, blacklist);

    if (proxied.isEmpty()) return new AdapterPeripheral(methods, target);

    Set<Class<?>> allImplemented = Sets.newHashSet(proxied);
    allImplemented.add(IPeripheral.class);

    InvocationHandler handler = new ProxyAdapterPeripheral(methods, target);
View Full Code Here

TOP

Related Classes of openperipheral.adapter.peripheral.AdapterPeripheral

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.