class 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;
    }

}