@Override public boolean equals(final Object obj) { try { if ((obj != null) && (obj instanceof FlurKey)) { final FlurKey other = (FlurKey) obj; if (((gemarkungsId != null) && (other.getGemarkungsId() != null) && gemarkungsId.equals(other.getGemarkungsId())) || ((gemarkungsId == null) && (other.getGemarkungsId() == null))) { if (LOG.isDebugEnabled()) { LOG.debug("Gemarkung stimmt überein"); } if (((flurId != null) && (other.getFlurId() != null) && flurId.equals(other.getFlurId())) || ((flurId == null) && (other.getFlurId() == null))) { if (LOG.isDebugEnabled()) { LOG.debug("Alle Felder stimmen überein --> equals"); } return true; } } } return false; } catch (Exception ex) { LOG.error("Fehler in equals Flurkey", ex); } return false; }
@Override public int compareTo(final Object value) { if (value instanceof FlurKey) { final FlurKey other = (FlurKey) value; if ((other != null) && (other.toString() != null) && (toString() != null)) { try { return (new Integer(toString())).compareTo(new Integer(other.toString())); } catch (Exception ex) { return toString().compareTo(other.toString()); } } else if (toString() == null) { return -1; } else { return 1; } } else { return 1; } }