@Test public void testCompareTo() { ValueHolder holder1 = new NonComparableHolder(); ValueHolder holder2 = new StringHolder("abc"); int result = holder1.compareTo(holder2); assertEquals(0, result); }
@Override @SuppressWarnings("unchecked") public int compareTo(ValueHolder o) { if (isComparable()) { Comparable<Object> v1 = (Comparable<Object>) this.getValue(); Comparable<Object> v2 = (Comparable<Object>) o.getValue(); if (v1 != null) { return v2 != null ? v1.compareTo(v2) : 1; } else { return v2 != null ? -1 : 0; } } return 0; }
AbstractValueHolder implements ValueHolder { @Override @SuppressWarnings("unchecked") public int compareTo(ValueHolder o) { if (isComparable()) { Comparable<Object> v1 = (Comparable<Object>) this.getValue(); Comparable<Object> v2 = (Comparable<Object>) o.getValue(); if (v1 != null) { return v2 != null ? v1.compareTo(v2) : 1; } else { return v2 != null ? -1 : 0; } } return 0; } }
AbstractValueHolder implements ValueHolder { @Override @SuppressWarnings("unchecked") public int compareTo(ValueHolder o) { if (isComparable()) { Comparable<Object> v1 = (Comparable<Object>) this.getValue(); Comparable<Object> v2 = (Comparable<Object>) o.getValue(); if (v1 != null) { return v2 != null ? v1.compareTo(v2) : 1; } else { return v2 != null ? -1 : 0; } } return 0; }  }
AbstractValueHolder implements ValueHolder { @Override @SuppressWarnings("unchecked") public int compareTo(ValueHolder o) { if (isComparable()) { Comparable<Object> v1 = (Comparable<Object>) this.getValue(); Comparable<Object> v2 = (Comparable<Object>) o.getValue(); if (v1 != null) { return v2 != null ? v1.compareTo(v2) : 1; } else { return v2 != null ? -1 : 0; } } return 0; }  @Override boolean isNull(); @Override boolean isNotNull(); @Override boolean equals(Object obj); @Override int hashCode(); @Override boolean isComparable(); @Override @SuppressWarnings("unchecked") int compareTo(ValueHolder o); @Override String toString(); @Override String getString(); @Override int intValue(); @Override long longValue(); @Override double doubleValue(); @Override boolean booleanValue(); @Override Integer getInteger(); @Override Long getLong(); @Override Double getDouble(); @Override Boolean getBoolean(); @Override BigDecimal getBigDecimal(); @Override Date getDate(); }
AbstractValueHolder implements ValueHolder { @Override @SuppressWarnings("unchecked") public int compareTo(ValueHolder o) { if (isComparable()) { Comparable<Object> v1 = (Comparable<Object>) this.getValue(); Comparable<Object> v2 = (Comparable<Object>) o.getValue(); if (v1 != null) { return v2 != null ? v1.compareTo(v2) : 1; } else { return v2 != null ? -1 : 0; } } return 0; }  @Override boolean isNull(); @Override boolean isNotNull(); @Override boolean equals(Object obj); @Override int hashCode(); @Override boolean isComparable(); @Override @SuppressWarnings("unchecked") int compareTo(ValueHolder o); @Override String toString(); @Override String getString(); @Override int intValue(); @Override long longValue(); @Override double doubleValue(); @Override boolean booleanValue(); @Override Integer getInteger(); @Override Long getLong(); @Override Double getDouble(); @Override Boolean getBoolean(); @Override BigDecimal getBigDecimal(); @Override Date getDate();  }