@Test public void equal_across_types() { Metric m = new SimpleMetric(MetricName.valueOf("foobar"), MetricValue.fromIntValue(19)); assertFalse(m.equals(null)); assertFalse(m.equals(new Object())); }
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final SimpleMetric other = (SimpleMetric) obj; if (!Objects.equals(this.name_, other.name_)) { return false; } if (!Objects.equals(this.value_, other.value_)) { return false; } return true; }
SimpleMetric implements Metric { @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final SimpleMetric other = (SimpleMetric) obj; if (!Objects.equals(this.name_, other.name_)) { return false; } if (!Objects.equals(this.value_, other.value_)) { return false; } return true; } }
SimpleMetric implements Metric { @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final SimpleMetric other = (SimpleMetric) obj; if (!Objects.equals(this.name_, other.name_)) { return false; } if (!Objects.equals(this.value_, other.value_)) { return false; } return true; } SimpleMetric(MetricName name, Boolean value);  SimpleMetric(MetricName name, Number value);  SimpleMetric(MetricName name, String value); @ConstructorProperties({ "name", "value" })  SimpleMetric(MetricName name, MetricValue value); }
SimpleMetric implements Metric { @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final SimpleMetric other = (SimpleMetric) obj; if (!Objects.equals(this.name_, other.name_)) { return false; } if (!Objects.equals(this.value_, other.value_)) { return false; } return true; } SimpleMetric(MetricName name, Boolean value);  SimpleMetric(MetricName name, Number value);  SimpleMetric(MetricName name, String value); @ConstructorProperties({ "name", "value" })  SimpleMetric(MetricName name, MetricValue value); @Override MetricName getName(); @Override MetricValue getValue(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); }
SimpleMetric implements Metric { @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final SimpleMetric other = (SimpleMetric) obj; if (!Objects.equals(this.name_, other.name_)) { return false; } if (!Objects.equals(this.value_, other.value_)) { return false; } return true; } SimpleMetric(MetricName name, Boolean value);  SimpleMetric(MetricName name, Number value);  SimpleMetric(MetricName name, String value); @ConstructorProperties({ "name", "value" })  SimpleMetric(MetricName name, MetricValue value); @Override MetricName getName(); @Override MetricValue getValue(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }