@Test public void testHashcode() { assertThat(WrapperType.ROOT.hashCode(), is(WrapperType.ROOT.hashCode())); assertThat(WrapperType.ROOT.hashCode(), is(WrapperType.of("", null).hashCode())); assertThat(WrapperType.of("", null).hashCode(), is(WrapperType.ROOT.hashCode())); assertThat(WrapperType.ROOT.hashCode(), is(not((WrapperType.COMPONENT.hashCode())))); assertThat(WrapperType.COMPONENT.hashCode(), is(not((WrapperType.ROOT.hashCode())))); assertThat(WrapperType.COMPONENT.hashCode(), is(WrapperType.COMPONENT.hashCode())); assertThat(WrapperType.COMPONENT.hashCode(), is(WrapperType.of("component", WrapperType.ROOT).hashCode())); assertThat(WrapperType.of("component", WrapperType.ROOT).hashCode(), is(WrapperType.COMPONENT.hashCode())); assertThat(WrapperType.COMPONENT.hashCode(), is(not((WrapperType.FIELD.hashCode())))); assertThat(WrapperType.FIELD.hashCode(), is(not((WrapperType.COMPONENT.hashCode())))); assertThat(WrapperType.FIELD.hashCode(), is(not(("field".hashCode())))); assertThat(WrapperType.FIELD.hashCode(), is(not((WrapperType.of("field", WrapperType.FIELD).hashCode())))); assertThat(WrapperType.FIELD.hashCode(), is(not((WrapperType.of("field", null).hashCode())))); assertThat(WrapperType.of("field", null).hashCode(), is(not((WrapperType.FIELD.hashCode())))); }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + name.hashCode(); if (parent != null) { result = parent.hashCode() + result * prime; } return result; }
WrapperType { @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + name.hashCode(); if (parent != null) { result = parent.hashCode() + result * prime; } return result; } }
WrapperType { @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + name.hashCode(); if (parent != null) { result = parent.hashCode() + result * prime; } return result; } private  WrapperType(String name, WrapperType parent); }
WrapperType { @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + name.hashCode(); if (parent != null) { result = parent.hashCode() + result * prime; } return result; } 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 int hashCode() { final int prime = 31; int result = 1; result = prime * result + name.hashCode(); if (parent != null) { result = parent.hashCode() + result * prime; } return result; } 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; }