missing unwrap class arg

This commit is contained in:
Adrian Cole 2012-04-16 11:14:13 -07:00
parent 9267ac29ba
commit 1d85435fe8
2 changed files with 14 additions and 3 deletions

View File

@ -51,7 +51,13 @@ public interface Wrapper {
* if the wrapped context is not assignable from the specified class.
* @see #getWrappedType()
*/
<C extends Closeable> C unwrap(TypeToken<C> type);
<C extends Closeable> C unwrap(TypeToken<C> type) throws IllegalArgumentException;
/**
* shortcut for {@code unwrap(TypeToken.of(clazz))}
* @see #unwrap(TypeToken)
*/
<C extends Closeable> C unwrap(Class<C> clazz) throws IllegalArgumentException;
/**
* shortcut for {@code unwrap(getWrappedType())}

View File

@ -54,6 +54,11 @@ public abstract class BaseWrapper implements Wrapper {
return (C) wrapped;
}
@Override
public <C extends Closeable> C unwrap(Class<C> clazz) {
return unwrap (TypeToken.of(checkNotNull(clazz, "clazz")));
}
@Override
public TypeToken<? extends Closeable> getWrappedType() {
return wrappedType;