@Test public void testIsWrapperFor() { assertTrue(decorator.isWrapperFor(MyClass.class)); assertFalse(decorator.isWrapperFor(MyOtherClass.class)); }
@Override public boolean isWrapperFor(Class<?> iface) { if (delegate instanceof Wrapper) return ((Wrapper) delegate).isWrapperFor(iface); else if (iface.isInstance(delegate)) return true; else return false; }
AbstractDecorator implements Wrapper, Serializable { @Override public boolean isWrapperFor(Class<?> iface) { if (delegate instanceof Wrapper) return ((Wrapper) delegate).isWrapperFor(iface); else if (iface.isInstance(delegate)) return true; else return false; } }
AbstractDecorator implements Wrapper, Serializable { @Override public boolean isWrapperFor(Class<?> iface) { if (delegate instanceof Wrapper) return ((Wrapper) delegate).isWrapperFor(iface); else if (iface.isInstance(delegate)) return true; else return false; } AbstractDecorator(D delegate); }
AbstractDecorator implements Wrapper, Serializable { @Override public boolean isWrapperFor(Class<?> iface) { if (delegate instanceof Wrapper) return ((Wrapper) delegate).isWrapperFor(iface); else if (iface.isInstance(delegate)) return true; else return false; } AbstractDecorator(D delegate); @Override boolean isWrapperFor(Class<?> iface); @Override T unwrap(Class<T> iface); boolean equals(Object obj); int hashCode(); @Override String toString(); }
AbstractDecorator implements Wrapper, Serializable { @Override public boolean isWrapperFor(Class<?> iface) { if (delegate instanceof Wrapper) return ((Wrapper) delegate).isWrapperFor(iface); else if (iface.isInstance(delegate)) return true; else return false; } AbstractDecorator(D delegate); @Override boolean isWrapperFor(Class<?> iface); @Override T unwrap(Class<T> iface); boolean equals(Object obj); int hashCode(); @Override String toString();  }