Counter { @Override public boolean equals(@Nullable Object o) { if (this == o) { return true; } else if (o instanceof Counter) { Counter<?, ?> that = (Counter<?, ?>) o; return Objects.equals(this.name, that.name) && Objects.equals(internal.getClass(), that.internal.getClass()); } return false; } Counter(CounterName name, AtomicCounterValue<InputT, AccumT> internal); Counter<InputT, AccumT> addValue(InputT value); AccumT getAndReset(); CounterName getName(); UpdateT extractUpdate(
      boolean delta, CounterUpdateExtractor<UpdateT> updateExtractor); String getFlatName(); AccumT getAggregate(); boolean isDirty(); boolean committing(); boolean committed(); @Override String toString(); String toPrettyString(); @Override boolean equals(@Nullable Object o); @Override int hashCode();  }
@Test public void testStructuredNames() { Counter<?, ?> unstructured = counters.intSum(name); Counter<?, ?> structuredOriginal = counters.intSum(name.withOriginalName(NameContextsForTests.nameContextForTest())); Counter<?, ?> structuredSystem = counters.intSum(name.withSystemName(NameContextsForTests.nameContextForTest())); Counter<?, ?> structuredCompatible = counters.intSum(name.withOriginalName(NameContextsForTests.nameContextForTest())); assertFalse(unstructured.equals(structuredOriginal)); assertFalse(unstructured.equals(structuredSystem)); assertFalse(unstructured.equals(structuredCompatible)); assertEquals(structuredOriginal, structuredCompatible); assertFalse(structuredOriginal.equals(structuredSystem)); assertFalse(structuredSystem.equals(structuredCompatible)); }