@Test public void testIsAssignableFrom() { assertTrue(WrapperType.ROOT.isAssignableFrom(WrapperType.ROOT)); assertTrue(WrapperType.ROOT.isAssignableFrom(WrapperType.COMPONENT)); assertTrue(WrapperType.ROOT.isAssignableFrom(WrapperType.FIELD)); assertTrue(WrapperType.ROOT.isAssignableFrom(WrapperType.LAYOUT)); assertTrue(WrapperType.ROOT.isAssignableFrom(WrapperType.of("custom"))); assertTrue(WrapperType.ROOT.isAssignableFrom(WrapperType.of("customComponent", WrapperType.COMPONENT))); assertTrue(WrapperType.COMPONENT.isAssignableFrom(WrapperType.COMPONENT)); assertTrue(WrapperType.COMPONENT.isAssignableFrom(WrapperType.LAYOUT)); assertTrue(WrapperType.COMPONENT.isAssignableFrom(WrapperType.FIELD)); assertFalse(WrapperType.FIELD.isAssignableFrom(WrapperType.COMPONENT)); assertFalse(WrapperType.FIELD.isAssignableFrom(WrapperType.ROOT)); assertFalse(WrapperType.of("custom").isAssignableFrom(WrapperType.COMPONENT)); assertFalse(WrapperType.of("custom", WrapperType.COMPONENT).isAssignableFrom(WrapperType.COMPONENT)); }
public boolean isAssignableFrom(@CheckForNull WrapperType type) { return this.equals(type) || (type != null && isAssignableFrom(type.getParent())); }
WrapperType { public boolean isAssignableFrom(@CheckForNull WrapperType type) { return this.equals(type) || (type != null && isAssignableFrom(type.getParent())); } }
WrapperType { public boolean isAssignableFrom(@CheckForNull WrapperType type) { return this.equals(type) || (type != null && isAssignableFrom(type.getParent())); } private  WrapperType(String name, WrapperType parent); }
WrapperType { public boolean isAssignableFrom(@CheckForNull WrapperType type) { return this.equals(type) || (type != null && isAssignableFrom(type.getParent())); } private  WrapperType(String name, WrapperType parent); static WrapperType of(String name); static WrapperType of(String name, WrapperType parent); @CheckForNull WrapperType getParent(); boolean isRoot(); boolean isAssignableFrom(@CheckForNull WrapperType type); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); }
WrapperType { public boolean isAssignableFrom(@CheckForNull WrapperType type) { return this.equals(type) || (type != null && isAssignableFrom(type.getParent())); } private  WrapperType(String name, WrapperType parent); static WrapperType of(String name); static WrapperType of(String name, WrapperType parent); @CheckForNull WrapperType getParent(); boolean isRoot(); boolean isAssignableFrom(@CheckForNull WrapperType type); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); static final WrapperType ROOT; static final WrapperType COMPONENT; static final WrapperType LAYOUT; static final WrapperType FIELD; }