@SuppressWarnings("unchecked") public <B, R extends ServiceReference<B>> R cast(B target) throws IllegalArgumentException { return (R)proxyFactory.cast(target); }
@SuppressWarnings("unchecked") public <B, R extends ServiceReference<B>> R cast(B target) throws IllegalArgumentException { return (R)proxyFactory.cast(target); }
public <B> ServiceReference<B> cast(B target) throws IllegalArgumentException { return proxyFactory.cast(target); }
/** * @see org.apache.tuscany.sca.core.invocation.ProxyFactory#cast(java.lang.Object) */ @SuppressWarnings("unchecked") public <B, R extends ServiceReference<B>> R cast(B target) throws IllegalArgumentException { ProxyFactory interfaceFactory = proxyFactories.getInterfaceProxyFactory(); ProxyFactory classFactory = proxyFactories.getClassProxyFactory(); if (interfaceFactory.isProxyClass(target.getClass())) { return (R)interfaceFactory.cast(target); } else if (classFactory != null && classFactory.isProxyClass(target.getClass())) { return (R)classFactory.cast(target); } else { throw new IllegalArgumentException("The target is not a callable proxy"); } }