data-generator/datagen-plugin/src/main/java/it/cavallium/datagen/plugin/NewDataConfiguration.java

68 lines
1.9 KiB
Java
Raw Normal View History

2023-04-20 10:11:12 +02:00
package it.cavallium.datagen.plugin;
2022-02-20 02:56:51 +01:00
2022-07-19 02:10:14 +02:00
import java.util.Objects;
2023-01-18 02:38:12 +01:00
import org.jetbrains.annotations.Nullable;
2022-07-19 02:10:14 +02:00
2022-02-20 02:56:51 +01:00
public class NewDataConfiguration implements TransformationConfiguration {
public String transformClass;
public String to;
2023-01-18 01:48:54 +01:00
public String type;
2022-02-20 02:56:51 +01:00
public String initializer;
public String initializerInstance;
2023-01-18 02:38:12 +01:00
@Nullable
public Integer index;
2022-02-20 02:56:51 +01:00
@Override
public String getTransformClass() {
return transformClass;
}
@Override
public String getTransformName() {
return "new-data";
}
2022-07-19 02:10:14 +02:00
public JInterfaceLocation getInitializerLocation() {
return JInterfaceLocation.parse(initializer, initializerInstance);
}
2022-07-19 02:10:14 +02:00
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
NewDataConfiguration that = (NewDataConfiguration) o;
2023-01-18 01:48:54 +01:00
return Objects.equals(transformClass, that.transformClass) && Objects.equals(to, that.to)
2023-01-18 02:38:12 +01:00
&& Objects.equals(type, that.type) && Objects.equals(initializer, that.initializer)
&& Objects.equals(initializerInstance, that.initializerInstance)
2023-01-18 02:38:12 +01:00
&& Objects.equals(index, that.index);
2022-07-19 02:10:14 +02:00
}
@Override
public int hashCode() {
2022-07-19 02:45:20 +02:00
int hash = 0;
hash += ConfigUtils.hashCode(transformClass);
hash += ConfigUtils.hashCode(to);
2023-01-18 01:48:54 +01:00
hash += ConfigUtils.hashCode(type);
2022-07-19 02:45:20 +02:00
hash += ConfigUtils.hashCode(initializer);
hash += ConfigUtils.hashCode(initializerInstance);
2023-01-18 02:38:12 +01:00
hash += ConfigUtils.hashCode(index);
2022-07-19 02:45:20 +02:00
return hash;
2022-07-19 02:10:14 +02:00
}
2023-01-18 01:48:54 +01:00
2023-01-21 21:00:40 +01:00
public NewDataConfiguration copy() {
2023-01-18 01:48:54 +01:00
var c = new NewDataConfiguration();
if (this.transformClass != null) c.transformClass = this.transformClass;
if (this.initializer != null) c.initializer = this.initializer;
if (this.initializerInstance != null) c.initializerInstance = this.initializerInstance;
2023-01-18 01:48:54 +01:00
if (this.to != null) c.to = this.to;
if (this.type != null) c.type = this.type;
2023-01-18 02:38:12 +01:00
if (this.index != null) c.index = this.index;
2023-01-18 01:48:54 +01:00
return c;
}
2022-02-20 02:56:51 +01:00
}