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,8 +51,14 @@ 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

@ -53,7 +53,12 @@ public abstract class BaseWrapper implements Wrapper {
checkArgument(checkNotNull(type, "type").isAssignableFrom(wrappedType), "wrapped type: %s not assignable from %s", wrappedType, type);
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;