Beispiel #1
0
  @Override
  public ConstantImpl clone() {
    ConstantImpl clone = new ConstantImpl(this.getTeiidParser(), this.getId());

    if (getType() != null) clone.setType(getType());
    clone.setMultiValued(isMultiValued());
    if (getValue() != null) clone.setValue(getValue());

    return clone;
  }
Beispiel #2
0
  @Override
  public boolean equals(Object obj) {
    if (this == obj) return true;
    if (!super.equals(obj)) return false;
    if (getClass() != obj.getClass()) return false;
    ConstantImpl other = (ConstantImpl) obj;

    if (this.getValue() == null && other.getValue() == null) {
      // Only consider type information if values are not null
      return true;
    }

    if (this.getValue() instanceof BigDecimal) {
      if (this.getValue() == other.getValue()) {
        return true;
      }
      if (!(other.getValue() instanceof BigDecimal)) {
        return false;
      }
      return ((BigDecimal) this.getValue()).compareTo((BigDecimal) other.getValue()) == 0;
    }

    if (this.getType() == null) {
      if (other.getType() != null) return false;
    } else if (!this.getType().equals(other.getType())) return false;

    return isMultiValued() == other.isMultiValued() && other.getValue().equals(this.getValue());
  }