org.webpieces.aws.storage.impl.ChannelWrapper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of s3-client Show documentation
Show all versions of s3-client Show documentation
Not filled in for this project
The newest version!
package org.webpieces.aws.storage.impl;
import java.lang.reflect.Proxy;
import java.nio.channels.Channel;
import javax.inject.Inject;
import javax.inject.Provider;
public class ChannelWrapper {
private Provider invocHandlerProvider;
@Inject
public ChannelWrapper(Provider invocHandlerProvider) {
this.invocHandlerProvider = invocHandlerProvider;
}
public T newChannelProxy(Class intf, T channel) {
ChannelInvocationHandler invocHandler = invocHandlerProvider.get();
invocHandler.setChannel(channel);
return (T) Proxy.newProxyInstance(channel.getClass().getClassLoader(),
new Class[] {intf, Channel.class},
invocHandler);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy