@SuppressWarnings("unlikely-arg-type") @Test public void testEquals() { assertTrue(WrapperType.ROOT.equals(WrapperType.ROOT)); assertTrue(WrapperType.ROOT.equals(WrapperType.of("", null))); assertTrue(WrapperType.of("", null).equals(WrapperType.ROOT)); assertFalse(WrapperType.ROOT.equals(WrapperType.COMPONENT)); assertFalse(WrapperType.COMPONENT.equals(WrapperType.ROOT)); assertTrue(WrapperType.COMPONENT.equals(WrapperType.COMPONENT)); assertTrue(WrapperType.COMPONENT.equals(WrapperType.of("component", WrapperType.ROOT))); assertTrue(WrapperType.of("component", WrapperType.ROOT).equals(WrapperType.COMPONENT)); assertFalse(WrapperType.COMPONENT.equals(WrapperType.FIELD)); assertFalse(WrapperType.FIELD.equals(WrapperType.COMPONENT)); assertFalse(WrapperType.FIELD.equals("field")); assertFalse(WrapperType.FIELD.equals(WrapperType.of("field", WrapperType.FIELD))); assertFalse(WrapperType.FIELD.equals(WrapperType.of("field", null))); assertFalse(WrapperType.of("field", null).equals(WrapperType.FIELD)); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } WrapperType other = (WrapperType)obj; if (!name.equals(other.name)) { return false; } if (parent == null) { if (other.parent != null) { return false; } } else if (!parent.equals(other.parent)) { return false; } return true; }
WrapperType { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } WrapperType other = (WrapperType)obj; if (!name.equals(other.name)) { return false; } if (parent == null) { if (other.parent != null) { return false; } } else if (!parent.equals(other.parent)) { return false; } return true; } }
WrapperType { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } WrapperType other = (WrapperType)obj; if (!name.equals(other.name)) { return false; } if (parent == null) { if (other.parent != null) { return false; } } else if (!parent.equals(other.parent)) { return false; } return true; } private  WrapperType(String name, WrapperType parent); }
WrapperType { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } WrapperType other = (WrapperType)obj; if (!name.equals(other.name)) { return false; } if (parent == null) { if (other.parent != null) { return false; } } else if (!parent.equals(other.parent)) { return false; } return true; } 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 { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } WrapperType other = (WrapperType)obj; if (!name.equals(other.name)) { return false; } if (parent == null) { if (other.parent != null) { return false; } } else if (!parent.equals(other.parent)) { return false; } return true; } 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; }