All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.dmj.sqldsl.model.column.ValueColumn Maven / Gradle / Ivy

There is a newer version: 1.0.6
Show newest version
package com.dmj.sqldsl.model.column;

import java.util.Optional;
import lombok.EqualsAndHashCode.Exclude;

public class ValueColumn implements Column {
  private final Object value;
  private boolean isNullValue;
  private String fieldName;
  private String columnName;

  public ValueColumn(Object value, String fieldName, String columnName) {
    this.value = value;
    this.isNullValue = value == null;
    this.fieldName = fieldName;
    this.columnName = columnName;
  }

  public ValueColumn(Object value) {
    this.value = value;
  }

  @Override
  public Optional getTableName() {
    return Optional.empty();
  }

  @Override
  public String getFieldName() {
    return fieldName;
  }

  @Override
  public String getColumnName() {
    return columnName;
  }

  public Object getValue() {
    return this.value;
  }

  public boolean isNullValue() {
    return this.isNullValue;
  }

  @Override
  public boolean equals(final Object o) {
    if (o == this) return true;
    if (!(o instanceof ValueColumn)) return false;
    final ValueColumn other = (ValueColumn) o;
    if (!other.canEqual((Object) this)) return false;
    if (this.isNullValue() != other.isNullValue()) return false;
    final Object this$fieldName = this.getFieldName();
    final Object other$fieldName = other.getFieldName();
    if (this$fieldName == null ? other$fieldName != null : !this$fieldName.equals(other$fieldName)) return false;
    final Object this$columnName = this.getColumnName();
    final Object other$columnName = other.getColumnName();
    if (this$columnName == null ? other$columnName != null : !this$columnName.equals(other$columnName)) return false;
    return true;
  }

  protected boolean canEqual(final Object other) {
    return other instanceof ValueColumn;
  }

  @Override
  public int hashCode() {
    final int PRIME = 59;
    int result = 1;
    result = result * PRIME + (this.isNullValue() ? 79 : 97);
    final Object $fieldName = this.getFieldName();
    result = result * PRIME + ($fieldName == null ? 43 : $fieldName.hashCode());
    final Object $columnName = this.getColumnName();
    result = result * PRIME + ($columnName == null ? 43 : $columnName.hashCode());
    return result;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy