Skip to content

World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.

[#1220] improvement: Remove Lombok annotation from API module (#1359)

Won Joon Thomas Choi7086ecaeb31b
diff --git a/api/build.gradle.kts b/api/build.gradle.kts
index 8371c26210..55acdc6e2f 100644
--- a/api/build.gradle.kts
+++ b/api/build.gradle.kts
@@ -12,11 +12,6 @@ dependencies {
implementation(libs.guava)
implementation(libs.slf4j.api)
- compileOnly(libs.lombok)
- annotationProcessor(libs.lombok)
- testCompileOnly(libs.lombok)
- testAnnotationProcessor(libs.lombok)
-
testImplementation(libs.junit.jupiter.api)
testImplementation(libs.junit.jupiter.params)
testRuntimeOnly(libs.junit.jupiter.engine)
diff --git a/api/src/main/java/com/datastrato/gravitino/CatalogChange.java b/api/src/main/java/com/datastrato/gravitino/CatalogChange.java
index 10cfc849b1..79480528e6 100644
--- a/api/src/main/java/com/datastrato/gravitino/CatalogChange.java
+++ b/api/src/main/java/com/datastrato/gravitino/CatalogChange.java
@@ -4,8 +4,7 @@
*/
package com.datastrato.gravitino;
-import lombok.EqualsAndHashCode;
-import lombok.Getter;
+import java.util.Objects;
/**
* A catalog change is a change to a catalog. It can be used to rename a catalog, update the comment
@@ -55,30 +54,117 @@ public interface CatalogChange {
}
/** A catalog change to rename the catalog. */
- @Getter
- @EqualsAndHashCode
final class RenameCatalog implements CatalogChange {
private final String newName;
private RenameCatalog(String newName) {
this.newName = newName;
}
+
+ /**
+ * Retrieves the new name set for the catalog.
+ *
+ * @return The new name of the catalog.
+ */
+ public String getNewName() {
+ return newName;
+ }
+
+ /**
+ * Compares this RenameCatalog instance with another object for equality. Two instances are
+ * considered equal if they designate the same new name for the catalog.
+ *
+ * @param o The object to compare with this instance.
+ * @return true if the given object represents an identical catalog renaming operation; false
+ * otherwise.
+ */
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ RenameCatalog that = (RenameCatalog) o;
+ return Objects.equals(newName, that.newName);
+ }
+
+ /**
+ * Generates a hash code for this RenameCatalog instance. The hash code is primarily based on
+ * the new name for the catalog.
+ *
+ * @return A hash code value for this renaming operation.
+ */
+ @Override
+ public int hashCode() {
+ return Objects.hash(newName);
+ }
+
+ /**
+ * Provides a string representation of the RenameCatalog instance. This string includes the
+ * class name followed by the new name of the catalog.
+ *
+ * @return A string summary of this renaming operation.
+ */
+ @Override
+ public String toString() {
+ return "RENAMECATALOG " + newName;
+ }
}
/** A catalog change to update the catalog comment. */
- @Getter
- @EqualsAndHashCode
final class UpdateCatalogComment implements CatalogChange {
private final String newComment;
private UpdateCatalogComment(String newComment) {
this.newComment = newComment;
}
+
+ /**
+ * Retrieves the new comment intended for the catalog.
+ *
+ * @return The new comment that has been set for the catalog.
+ */
+ public String getNewComment() {
+ return newComment;
+ }
+
+ /**
+ * Compares this UpdateCatalogComment instance with another object for equality. Two instances
+ * are considered equal if they designate the same new comment for the catalog.
+ *
+ * @param o The object to compare with this instance.
+ * @return true if the given object represents the same comment update; false otherwise.
+ */
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ UpdateCatalogComment that = (UpdateCatalogComment) o;
+ return Objects.equals(newComment, that.newComment);
+ }
+
+ /**
+ * Generates a hash code for this UpdateCatalogComment instance. The hash code is based on the
+ * new comment for the catalog.
+ *
+ * @return A hash code representing this comment update operation.
+ */
+ @Override
+ public int hashCode() {
+ return Objects.hash(newComment);
+ }
+
+ /**
+ * Provides a string representation of the UpdateCatalogComment instance. This string format
+ * includes the class name followed by the new comment for the catalog.
+ *
+ * @return A string summary of this comment update operation.
+ */
+ @Override
+ public String toString() {
+ return "UPDATECATALOGCOMMENT " + newComment;
+ }
}
/** A catalog change to set the property and value for the catalog. */
- @Getter
- @EqualsAndHashCode
final class SetProperty implements CatalogChange {
private final String property;
private final String value;
@@ -87,16 +173,115 @@ public interface CatalogChange {
this.property = property;
this.value = value;
}
+
+ /**
+ * Retrieves the name of the property being set in the catalog.
+ *
+ * @return The name of the property.
+ */
+ public String getProperty() {
+ return property;
+ }
+
+ /**
+ * Retrieves the value assigned to the property in the catalog.
+ *
+ * @return The value of the property.
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * Compares this SetProperty instance with another object for equality. Two instances are
+ * considered equal if they have the same property and value for the catalog.
+ *
+ * @param o The object to compare with this instance.
+ * @return true if the given object represents the same property setting; false otherwise.
+ */
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ SetProperty that = (SetProperty) o;
+ return Objects.equals(property, that.property) && Objects.equals(value, that.value);
+ }
+
+ /**
+ * Generates a hash code for this SetProperty instance. The hash code is based on both the
+ * property name and its assigned value.
+ *
+ * @return A hash code value for this property setting.
+ */
+ @Override
+ public int hashCode() {
+ return Objects.hash(property, value);
+ }
+
+ /**
+ * Provides a string representation of the SetProperty instance. This string format includes the
+ * class name followed by the property and its value.
+ *
+ * @return A string summary of the property setting.
+ */
+ @Override
+ public String toString() {
+ return "SETPROPERTY " + property + " " + value;
+ }
}
/** A catalog change to remove a property from the catalog. */
- @Getter
- @EqualsAndHashCode
final class RemoveProperty implements CatalogChange {
private final String property;
private RemoveProperty(String property) {
this.property = property;
}
+
+ /**
+ * Retrieves the name of the property to be removed from the catalog.
+ *
+ * @return The name of the property for removal.
+ */
+ public String getProperty() {
+ return property;
+ }
+
+ /**
+ * Compares this RemoveProperty instance with another object for equality. Two instances are
+ * considered equal if they target the same property for removal from the catalog.
+ *
+ * @param o The object to compare with this instance.
+ * @return true if the given object represents the same property removal; false otherwise.
+ */
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ RemoveProperty that = (RemoveProperty) o;
+ return Objects.equals(property, that.property);
+ }
+
+ /**
+ * Generates a hash code for this RemoveProperty instance. The hash code is based on the
+ * property name that is to be removed from the catalog.
+ *
+ * @return A hash code value for this property removal operation.
+ */
+ @Override
+ public int hashCode() {
+ return Objects.hash(property);
+ }
+
+ /**
+ * Provides a string representation of the RemoveProperty instance. This string format includes
+ * the class name followed by the property name to be removed.
+ *
+ * @return A string summary of the property removal operation.
+ */
+ @Override
+ public String toString() {
+ return "REMOVEPROPERTY " + property;
+ }
}
}
diff --git a/api/src/main/java/com/datastrato/gravitino/MetalakeChange.java b/api/src/main/java/com/datastrato/gravitino/MetalakeChange.java
index 97d69ed3b9..2372f725a8 100644
--- a/api/src/main/java/com/datastrato/gravitino/MetalakeChange.java
+++ b/api/src/main/java/com/datastrato/gravitino/MetalakeChange.java
@@ -4,8 +4,7 @@
*/
package com.datastrato.gravitino;
-import lombok.EqualsAndHashCode;
-import lombok.Getter;
+import java.util.Objects;
/**
* A metalake change is a change to a metalake. It can be used to rename a metalake, update the
@@ -56,30 +55,113 @@ public interface MetalakeChange {
}
/** A metalake change to rename the metalake. */
- @Getter
- @EqualsAndHashCode
final class RenameMetalake implements MetalakeChange {
private final String newName;
private RenameMetalake(String newName) {
this.newName = newName;
}
+
+ /**
+ * Retrieves the new name intended for the Metalake.
+ *
+ * @return The new name to be set for the Metalake.
+ */
+ public String getNewName() {
+ return newName;
+ }
+
+ /**
+ * Compares this RenameMetalake instance with another object for equality.
+ *
+ * @param o The object to compare with this instance.
+ * @return true if the given object represents an identical renaming operation; false otherwise.
+ */
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ RenameMetalake that = (RenameMetalake) o;
+ return Objects.equals(newName, that.newName);
+ }
+
+ /**
+ * Generates a hash code for this RenameMetalake instance.
+ *
+ * @return A hash code representing this renaming operation.
+ */
+ @Override
+ public int hashCode() {
+ return Objects.hash(newName);
+ }
+
+ /**
+ * Provides a string representation of the RenameMetalake instance. This string includes the
+ * class name and the new name set for the Metalake
+ *
+ * @return A string summary of this renaming operation.
+ */
+ @Override
+ public String toString() {
+ return "RENAMEMETALAKE " + newName;
+ }
}
/** A metalake change to update the metalake comment. */
- @Getter
- @EqualsAndHashCode
final class UpdateMetalakeComment implements MetalakeChange {
private final String newComment;
private UpdateMetalakeComment(String newComment) {
this.newComment = newComment;
}
+
+ /**
+ * Retrieves the new comment intended for the Metalake.
+ *
+ * @return The new comment.
+ */
+ public String getNewComment() {
+ return newComment;
+ }
+
+ /**
+ * Compares this UpdateMetalakeComment instance with another object for equality.
+ *
+ * @param o The object to compare with this instance.
+ * @return true if the given object is an UpdateMetalakeComment with the same new comment; false
+ * otherwise.
+ */
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ UpdateMetalakeComment that = (UpdateMetalakeComment) o;
+ return Objects.equals(newComment, that.newComment);
+ }
+
+ /**
+ * Generates a hash code for this UpdateMetalakeComment instance.
+ *
+ * @return A hash code representing this updating operation.
+ */
+ @Override
+ public int hashCode() {
+ return Objects.hash(newComment);
+ }
+
+ /**
+ * Provides a string representation of the UpdateMetalakeComment instance. This string format
+ * includes the class name followed by the new comment.
+ *
+ * @return A string summary of the object.
+ */
+ @Override
+ public String toString() {
+ return "UPDATEMETALAKECOMMENT " + newComment;
+ }
}
/** A metalake change to set a property and value pair for the metalake. */
- @Getter
- @EqualsAndHashCode
final class SetProperty implements MetalakeChange {
private final String property;
private final String value;
@@ -88,16 +170,115 @@ public interface MetalakeChange {
this.property = property;
this.value = value;
}
+
+ /**
+ * Retrieves the name of the property.
+ *
+ * @return The name of the property set for the Metalake.
+ */
+ public String getProperty() {
+ return property;
+ }
+
+ /**
+ * Retrieves the value assigned to the property.
+ *
+ * @return The value of the property set for the Metalake.
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * Compares this SetProperty instance with another object for equality. Two instances are
+ * considered equal if they have the same property name and value.
+ *
+ * @param o The object to compare with this instance.
+ * @return true if the given object represents the same property setting; false otherwise.
+ */
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ SetProperty that = (SetProperty) o;
+ return Objects.equals(property, that.property) && Objects.equals(value, that.value);
+ }
+
+ /**
+ * Generates a hash code for this SetProperty instance. This hash code is based on both the
+ * property name and value.
+ *
+ * @return A hash code value for this property setting.
+ */
+ @Override
+ public int hashCode() {
+ return Objects.hash(property, value);
+ }
+
+ /**
+ * Provides a string representation of the SetProperty instance. This string format includes the
+ * class name followed by the property name and its value.
+ *
+ * @return A string summary of the property setting.
+ */
+ @Override
+ public String toString() {
+ return "SETPROPERTY " + property + " " + value;
+ }
}
/** A metalake change to remove a property from the metalake. */
- @Getter
- @EqualsAndHashCode
final class RemoveProperty implements MetalakeChange {
private final String property;
private RemoveProperty(String property) {
this.property = property;
}
+
+ /**
+ * Retrieves the name of the property to be removed.
+ *
+ * @return The name of the property for removal.
+ */
+ public String getProperty() {
+ return property;
+ }
+
+ /**
+ * Compares this RemoveProperty instance with another object for equality. Two instances are
+ * considered equal if they target the same property for removal.
+ *
+ * @param o The object to compare with this instance.
+ * @return true if the given object represents the same property removal; false otherwise.
+ */
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ RemoveProperty that = (RemoveProperty) o;
+ return Objects.equals(property, that.property);
+ }
+
+ /**
+ * Generates a hash code for this RemoveProperty instance. This hash code is based on the
+ * property name that is to be removed.
+ *
+ * @return A hash code value for this property removal operation.
+ */
+ @Override
+ public int hashCode() {
+ return Objects.hash(property);
+ }
+
+ /**
+ * Provides a string representation of the RemoveProperty instance. This string format includes
+ * the class name followed by the property name to be removed.
+ *
+ * @return A string summary of the property removal operation.
+ */
+ @Override
+ public String toString() {
+ return "REMOVEPROPERTY " + property;
+ }
}
}
diff --git a/api/src/main/java/com/datastrato/gravitino/rel/SchemaChange.java b/api/src/main/java/com/datastrato/gravitino/rel/SchemaChange.java
index 2058dde338..1134a1d191 100644
--- a/api/src/main/java/com/datastrato/gravitino/rel/SchemaChange.java
+++ b/api/src/main/java/com/datastrato/gravitino/rel/SchemaChange.java
@@ -20,8 +20,7 @@
package com.datastrato.gravitino.rel;
-import lombok.EqualsAndHashCode;
-import lombok.Getter;
+import java.util.Objects;
/** NamespaceChange class to set the property and value pairs for the namespace. */
public interface SchemaChange {
@@ -47,8 +46,6 @@ public interface SchemaChange {
return new RemoveProperty(property);
}
- @Getter
- @EqualsAndHashCode
final class SetProperty implements SchemaChange {
private final String property;
private final String value;
@@ -57,15 +54,114 @@ public interface SchemaChange {
this.property = property;
this.value = value;
}
+
+ /**
+ * Retrieves the name of the property to be set.
+ *
+ * @return The name of the property.
+ */
+ public String getProperty() {
+ return property;
+ }
+
+ /**
+ * Retrieves the value of the property to be set.
+ *
+ * @return The value of the property.
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * Compares this SetProperty instance with another object for equality. Two instances are
+ * considered equal if they have the same property and value.
+ *
+ * @param o The object to compare with this instance.
+ * @return true if the given object represents the same property setting; false otherwise.
+ */
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ SetProperty that = (SetProperty) o;
+ return Objects.equals(property, that.property) && Objects.equals(value, that.value);
+ }
+
+ /**
+ * Generates a hash code for this SetProperty instance. The hash code is based on both the
+ * property name and its value.
+ *
+ * @return A hash code value for this property setting.
+ */
+ @Override
+ public int hashCode() {
+ return Objects.hash(property, value);
+ }
+
+ /**
+ * Provides a string representation of the SetProperty instance. This string format includes the
+ * class name followed by the property name and its value.
+ *
+ * @return A string summary of the property setting.
+ */
+ @Override
+ public String toString() {
+ return "SETPROPERTY " + property + " " + value;
+ }
}
- @Getter
- @EqualsAndHashCode
final class RemoveProperty implements SchemaChange {
private final String property;
private RemoveProperty(String property) {
this.property = property;
}
+
+ /**
+ * Retrieves the name of the property to be removed.
+ *
+ * @return The name of the property for removal.
+ */
+ public String getProperty() {
+ return property;
+ }
+
+ /**
+ * Compares this RemoveProperty instance with another object for equality. Two instances are
+ * considered equal if they target the same property for removal.
+ *
+ * @param o The object to compare with this instance.
+ * @return true if the given object represents the same property removal; false otherwise.
+ */
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ RemoveProperty that = (RemoveProperty) o;
+ return Objects.equals(property, that.property);
+ }
+
+ /**
+ * Generates a hash code for this RemoveProperty instance. This hash code is based on the
+ * property name that is to be removed.
+ *
+ * @return A hash code value for this property removal operation.
+ */
+ @Override
+ public int hashCode() {
+ return Objects.hash(property);
+ }
+
+ /**
+ * Provides a string representation of the RemoveProperty instance. This string format includes
+ * the class name followed by the property name to be removed.
+ *
+ * @return A string summary of the property removal operation.
+ */
+ @Override
+ public String toString() {
+ return "REMOVEPROPERTY " + property;
+ }
}
}
diff --git a/api/src/main/java/com/datastrato/gravitino/rel/TableChange.java b/api/src/main/java/com/datastrato/gravitino/rel/TableChange.java
index 85e24161b0..e60a989e44 100644
--- a/api/src/main/java/com/datastrato/gravitino/rel/TableChange.java
+++ b/api/src/main/java/com/datastrato/gravitino/rel/TableChange.java
@@ -23,8 +23,6 @@ package com.datastrato.gravitino.rel;
import com.datastrato.gravitino.rel.types.Type;
import java.util.Arrays;
import java.util.Objects;
-import lombok.EqualsAndHashCode;
-import lombok.Getter;
/**
* The TableChange interface defines the public API for managing tables in a schema. If the catalog
@@ -287,25 +285,113 @@ public interface TableChange {
}
/** A TableChange to rename a table. */
- @EqualsAndHashCode
- @Getter
final class RenameTable implements TableChange {
private final String newName;
private RenameTable(String newName) {
this.newName = newName;
}
+
+ /**
+ * Retrieves the new name for the table.
+ *
+ * @return The new name of the table.
+ */
+ public String getNewName() {
+ return newName;
+ }
+
+ /**
+ * Compares this RenameTable instance with another object for equality. The comparison is based
+ * on the new name of the table.
+ *
+ * @param o The object to compare with this instance.
+ * @return true if the given object represents the same table renaming; false otherwise.
+ */
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ RenameTable that = (RenameTable) o;
+ return newName.equals(that.newName);
+ }
+
+ /**
+ * Generates a hash code for this RenameTable instance. The hash code is based on the new name
+ * of the table.
+ *
+ * @return A hash code value for this table renaming operation.
+ */
+ @Override
+ public int hashCode() {
+ return newName.hashCode();
+ }
+
+ /**
+ * Returns a string representation of the RenameTable instance. This string format includes the
+ * class name followed by the property name to be renamed.
+ *
+ * @return A string summary of the property rename instance.
+ */
+ @Override
+ public String toString() {
+ return "RENAMETABLE " + newName;
+ }
}
/** A TableChange to update a table's comment. */
- @EqualsAndHashCode
- @Getter
final class UpdateComment implements TableChange {
private final String newComment;
private UpdateComment(String newComment) {
this.newComment = newComment;
}
+
+ /**
+ * Retrieves the new comment for the table.
+ *
+ * @return The new comment of the table.
+ */
+ public String getNewComment() {
+ return newComment;
+ }
+
+ /**
+ * Compares this UpdateComment instance with another object for equality. The comparison is
+ * based on the new comment of the table.
+ *
+ * @param o The object to compare with this instance.
+ * @return true if the given object represents the same table comment update; false otherwise.
+ */
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ UpdateComment that = (UpdateComment) o;
+ return newComment.equals(that.newComment);
+ }
+
+ /**
+ * Generates a hash code for this UpdateComment instance. The hash code is based on the new
+ * comment of the table.
+ *
+ * @return A hash code value for this table comment update operation.
+ */
+ @Override
+ public int hashCode() {
+ return newComment.hashCode();
+ }
+
+ /**
+ * Returns a string representation of the UpdateComment instance. This string format includes
+ * the class name followed by the property name to be updated.
+ *
+ * @return A string representation of the UpdateComment instance.
+ */
+ @Override
+ public String toString() {
+ return "UPDATECOMMENT " + newComment;
+ }
}
/**
@@ -313,8 +399,6 @@ public interface TableChange {
*
* <p>If the property already exists, it must be replaced with the new value.
*/
- @EqualsAndHashCode
- @Getter
final class SetProperty implements TableChange {
private final String property;
private final String value;
@@ -323,6 +407,61 @@ public interface TableChange {
this.property = property;
this.value = value;
}
+
+ /**
+ * Retrieves the name of the property.
+ *
+ * @return The name of the property.
+ */
+ public String getProperty() {
+ return property;
+ }
+
+ /**
+ * Retrieves the value of the property.
+ *
+ * @return The value of the property.
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * Compares this SetProperty instance with another object for equality. The comparison is based
+ * on both the property name and its value.
+ *
+ * @param o The object to compare with this instance.
+ * @return true if the given object represents the same property setting; false otherwise.
+ */
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ SetProperty that = (SetProperty) o;
+ return property.equals(that.property) && value.equals(that.value);
+ }
+
+ /**
+ * Generates a hash code for this SetProperty instance. The hash code is based on both the
+ * property name and its value.
+ *
+ * @return A hash code value for this property setting.
+ */
+ @Override
+ public int hashCode() {
+ return Objects.hash(property, value);
+ }
+
+ /**
+ * Returns a string representation of the SetProperty instance. This string format includes the
+ * class name followed by the property name and value to be set.
+ *
+ * @return A string representation of the SetProperty instance.
+ */
+ @Override
+ public String toString() {
+ return "SETPROPERTY " + property + " " + value;
+ }
}
/**
@@ -330,14 +469,58 @@ public interface TableChange {
*
* <p>If the property does not exist, the change should succeed.
*/
- @EqualsAndHashCode
- @Getter
final class RemoveProperty implements TableChange {
private final String property;
private RemoveProperty(String property) {
this.property = property;
}
+
+ /**
+ * Retrieves the name of the property to be removed from the table.
+ *
+ * @return The name of the property scheduled for removal.
+ */
+ public String getProperty() {
+ return property;
+ }
+
+ /**
+ * Compares this RemoveProperty instance with another object for equality. Two instances are
+ * considered equal if they target the same property for removal from the table.
+ *
+ * @param o The object to compare with this instance.
+ * @return true if the given object represents the same property removal; false otherwise.
+ */
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ RemoveProperty that = (RemoveProperty) o;
+ return property.equals(that.property);
+ }
+
+ /**
+ * Generates a hash code for this RemoveProperty instance. The hash code is based on the
+ * property name that is to be removed from the table.
+ *
+ * @return A hash code value for this property removal operation.
+ */
+ @Override
+ public int hashCode() {
+ return Objects.hash(property);
+ }
+
+ /**
+ * Provides a string representation of the RemoveProperty instance. This string format includes
+ * the class name followed by the property name to be removed.
+ *
+ * @return A string summary of the property removal operation.
+ */
+ @Override
+ public String toString() {
+ return "REMOVEPROPERTY " + property;
+ }
}
/**
@@ -380,8 +563,6 @@ public interface TableChange {
* that, the specified column may be a nested field, and then the given `column` refers to a field
* in the same struct.
*/
- @EqualsAndHashCode
- @Getter
final class After implements ColumnPosition {
private final String column;
@@ -390,6 +571,40 @@ public interface TableChange {
this.column = column;
}
+ /**
+ * Retrieves the name of the reference column after which the specified column will be placed.
+ *
+ * @return The name of the reference column.
+ */
+ public String getColumn() {
+ return column;
+ }
+
+ /**
+ * Compares this After instance with another object for equality. Two instances are considered
+ * equal if they refer to the same column name.
+ *
+ * @param o The object to compare with this instance.
+ * @return true if the given object refers to the same column; false otherwise.
+ */
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ After after = (After) o;
+ return column.equals(after.column);
+ }
+
+ /**
+ * Generates a hash code for this After instance. The hash code is based on the column name.
+ *
+ * @return A hash code value for this column positioning operation.
+ */
+ @Override
+ public int hashCode() {
+ return Objects.hash(column);
+ }
+
@Override
public String toString() {
return "AFTER " + column;
@@ -427,17 +642,12 @@ public interface TableChange {
* If the new field is nested and its parent does not exist or is not a struct, the change must
* result in an {@link IllegalArgumentException}.
*/
- @EqualsAndHashCode
final class AddColumn implements ColumnChange {
private final String[] fieldName;
-
- @Getter private final Type dataType;
-
- @Getter private final String comment;
-
- @Getter private final ColumnPosition position;
-
- @Getter private final boolean nullable;
+ private final Type dataType;
+ private final String comment;
+ private final ColumnPosition position;
+ private final boolean nullable;
private AddColumn(
String[] fieldName,
@@ -452,6 +662,83 @@ public interface TableChange {
this.nullable = nullable;
}
+ /**
+ * Retrieves the field name of the new column.
+ *
+ * @return An array of strings representing the field name.
+ */
+ public String[] getFieldName() {
+ return fieldName;
+ }
+
+ /**
+ * Retrieves the data type of the new column.
+ *
+ * @return The data type of the column.
+ */
+ public Type getDataType() {
+ return dataType;
+ }
+
+ /**
+ * Retrieves the comment for the new column.
+ *
+ * @return The comment associated with the column.
+ */
+ public String getComment() {
+ return comment;
+ }
+
+ /**
+ * Retrieves the position where the new column should be added.
+ *
+ * @return The position of the column.
+ */
+ public ColumnPosition getPosition() {
+ return position;
+ }
+
+ /**
+ * Checks if the new column is nullable.
+ *
+ * @return true if the column is nullable; false otherwise.
+ */
+ public boolean isNullable() {
+ return nullable;
+ }
+
+ /**
+ * Compares this AddColumn instance with another object for equality. The comparison is based on
+ * the field name, data type, comment, position, and nullability.
+ *
+ * @param o The object to compare with this instance.
+ * @return true if the given object represents the same column addition; false otherwise.
+ */
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ AddColumn addColumn = (AddColumn) o;
+ return nullable == addColumn.nullable
+ && Arrays.equals(fieldName, addColumn.fieldName)
+ && Objects.equals(dataType, addColumn.dataType)
+ && Objects.equals(comment, addColumn.comment)
+ && Objects.equals(position, addColumn.position);
+ }
+
+ /**
+ * Generates a hash code for this AddColumn instance. This hash code is based on the field name,
+ * data type, comment, position, and nullability.
+ *
+ * @return A hash code value for this column addition operation.
+ */
+ @Override
+ public int hashCode() {
+ int result = Objects.hash(dataType, comment, position, nullable);
+ result = 31 * result + Arrays.hashCode(fieldName);
+ return result;
+ }
+
@Override
public String[] fieldName() {
return fieldName;
@@ -466,17 +753,61 @@ public interface TableChange {
*
* <p>If the field does not exist, the change must result in an {@link IllegalArgumentException}.
*/
- @EqualsAndHashCode
final class RenameColumn implements ColumnChange {
private final String[] fieldName;
-
- @Getter private final String newName;
+ private final String newName;
private RenameColumn(String[] fieldName, String newName) {
this.fieldName = fieldName;
this.newName = newName;
}
+ /**
+ * Retrieves the hierarchical field name of the column to be renamed.
+ *
+ * @return An array of strings representing the field name.
+ */
+ public String[] getFieldName() {
+ return fieldName;
+ }
+
+ /**
+ * Retrieves the new name for the column.
+ *
+ * @return The new name of the column.
+ */
+ public String getNewName() {
+ return newName;
+ }
+
+ /**
+ * Compares this RenameColumn instance with another object for equality. The comparison is based
+ * on the field name array and the new name.
+ *
+ * @param o The object to compare with this instance.
+ * @return true if the given object represents the same column renaming; false otherwise.
+ */
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ RenameColumn that = (RenameColumn) o;
+ return Arrays.equals(fieldName, that.fieldName) && Objects.equals(newName, that.newName);
+ }
+
+ /**
+ * Generates a hash code for this RenameColumn instance. This hash code is based on both the
+ * hierarchical field name and the new name.
+ *
+ * @return A hash code value for this column renaming operation.
+ */
+ @Override
+ public int hashCode() {
+ int result = Objects.hash(newName);
+ result = 31 * result + Arrays.hashCode(fieldName);
+ return result;
+ }
+
@Override
public String[] fieldName() {
return fieldName;
@@ -490,17 +821,62 @@ public interface TableChange {
*
* <p>If the field does not exist, the change must result in an {@link IllegalArgumentException}.
*/
- @EqualsAndHashCode
final class UpdateColumnType implements ColumnChange {
private final String[] fieldName;
-
- @Getter private final Type newDataType;
+ private final Type newDataType;
private UpdateColumnType(String[] fieldName, Type newDataType) {
this.fieldName = fieldName;
this.newDataType = newDataType;
}
+ /**
+ * Retrieves the field name of the column whose data type is being updated.
+ *
+ * @return An array of strings representing the field name.
+ */
+ public String[] getFieldName() {
+ return fieldName;
+ }
+
+ /**
+ * Retrieves the new data type for the column.
+ *
+ * @return The new data type of the column.
+ */
+ public Type getNewDataType() {
+ return newDataType;
+ }
+
+ /**
+ * Compares this UpdateColumnType instance with another object for equality. The comparison is
+ * based on the field name array and the new data type.
+ *
+ * @param o The object to compare with this instance.
+ * @return true if the given object represents the same data type update; false otherwise.
+ */
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ UpdateColumnType that = (UpdateColumnType) o;
+ return Arrays.equals(fieldName, that.fieldName)
+ && Objects.equals(newDataType, that.newDataType);
+ }
+
+ /**
+ * Generates a hash code for this UpdateColumnType instance. The hash code is based on both the
+ * hierarchical field name and the new data type.
+ *
+ * @return A hash code value for this data type update operation.
+ */
+ @Override
+ public int hashCode() {
+ int result = Objects.hash(newDataType);
+ result = 31 * result + Arrays.hashCode(fieldName);
+ return result;
+ }
+
@Override
public String[] fieldName() {
return fieldName;
@@ -514,17 +890,62 @@ public interface TableChange {
*
* <p>If the field does not exist, the change must result in an {@link IllegalArgumentException}.
*/
- @EqualsAndHashCode
final class UpdateColumnComment implements ColumnChange {
private final String[] fieldName;
-
- @Getter private final String newComment;
+ private final String newComment;
private UpdateColumnComment(String[] fieldName, String newComment) {
this.fieldName = fieldName;
this.newComment = newComment;
}
+ /**
+ * Retrieves the field name of the column whose comment is being updated.
+ *
+ * @return An array of strings representing the field name.
+ */
+ public String[] getFieldName() {
+ return fieldName;
+ }
+
+ /**
+ * Retrieves the new comment for the column.
+ *
+ * @return The new comment of the column.
+ */
+ public String getNewComment() {
+ return newComment;
+ }
+
+ /**
+ * Compares this UpdateColumnComment instance with another object for equality. The comparison
+ * is based on the field name array and the new comment.
+ *
+ * @param o The object to compare with this instance.
+ * @return true if the given object represents the same comment update; false otherwise.
+ */
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ UpdateColumnComment that = (UpdateColumnComment) o;
+ return Arrays.equals(fieldName, that.fieldName)
+ && Objects.equals(newComment, that.newComment);
+ }
+
+ /**
+ * Generates a hash code for this UpdateColumnComment instance. The hash code is based on both
+ * the hierarchical field name and the new comment.
+ *
+ * @return A hash code value for this comment update operation.
+ */
+ @Override
+ public int hashCode() {
+ int result = Objects.hash(newComment);
+ result = 31 * result + Arrays.hashCode(fieldName);
+ return result;
+ }
+
@Override
public String[] fieldName() {
return fieldName;
@@ -538,17 +959,61 @@ public interface TableChange {
*
* <p>If the field does not exist, the change must result in an {@link IllegalArgumentException}.
*/
- @EqualsAndHashCode
final class UpdateColumnPosition implements ColumnChange {
private final String[] fieldName;
-
- @Getter private final ColumnPosition position;
+ private final ColumnPosition position;
private UpdateColumnPosition(String[] fieldName, ColumnPosition position) {
this.fieldName = fieldName;
this.position = position;
}
+ /**
+ * Retrieves the field name of the column whose position is being updated.
+ *
+ * @return An array of strings representing the field name.
+ */
+ public String[] getFieldName() {
+ return fieldName;
+ }
+
+ /**
+ * Retrieves the new position for the column.
+ *
+ * @return The new position of the column.
+ */
+ public ColumnPosition getPosition() {
+ return position;
+ }
+
+ /**
+ * Compares this UpdateColumnPosition instance with another object for equality. The comparison
+ * is based on the field name array and the new position.
+ *
+ * @param o The object to compare with this instance.
+ * @return true if the given object represents the same position update; false otherwise.
+ */
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ UpdateColumnPosition that = (UpdateColumnPosition) o;
+ return Arrays.equals(fieldName, that.fieldName) && Objects.equals(position, that.position);
+ }
+
+ /**
+ * Generates a hash code for this UpdateColumnPosition instance. The hash code is based on both
+ * the hierarchical field name and the new position.
+ *
+ * @return A hash code value for this position update operation.
+ */
+ @Override
+ public int hashCode() {
+ int result = Objects.hash(position);
+ result = 31 * result + Arrays.hashCode(fieldName);
+ return result;
+ }
+
@Override
public String[] fieldName() {
return fieldName;
@@ -560,17 +1025,61 @@ public interface TableChange {
*
* <p>If the field does not exist, the change must result in an {@link IllegalArgumentException}.
*/
- @EqualsAndHashCode
final class DeleteColumn implements ColumnChange {
private final String[] fieldName;
-
- @Getter private final Boolean ifExists;
+ private final Boolean ifExists;
private DeleteColumn(String[] fieldName, Boolean ifExists) {
this.fieldName = fieldName;
this.ifExists = ifExists;
}
+ /**
+ * Retrieves the field name of the column to be deleted.
+ *
+ * @return An array of strings representing the field name.
+ */
+ public String[] getFieldName() {
+ return fieldName;
+ }
+
+ /**
+ * Checks if the field should be deleted only if it exists.
+ *
+ * @return true if the field should be deleted only if it exists; false otherwise.
+ */
+ public Boolean getIfExists() {
+ return ifExists;
+ }
+
+ /**
+ * Compares this DeleteColumn instance with another object for equality. The comparison is based
+ * on the field name array and the 'ifExists' flag.
+ *
+ * @param o The object to compare with this instance.
+ * @return true if the given object represents the same field deletion; false otherwise.
+ */
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ DeleteColumn that = (DeleteColumn) o;
+ return Arrays.equals(fieldName, that.fieldName) && Objects.equals(ifExists, that.ifExists);
+ }
+
+ /**
+ * Generates a hash code for this DeleteColumn instance. The hash code is based on both the
+ * hierarchical field name and the 'ifExists' flag.
+ *
+ * @return A hash code value for this field deletion operation.
+ */
+ @Override
+ public int hashCode() {
+ int result = Objects.hash(ifExists);
+ result = 31 * result + Arrays.hashCode(fieldName);
+ return result;
+ }
+
@Override
public String[] fieldName() {
return fieldName;