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

51 lines
1.7 KiB
Java
Raw Normal View History

2023-04-20 10:11:12 +02:00
package it.cavallium.datagen.plugin;
2021-03-01 21:04:06 +01:00
import java.util.Map;
2022-07-19 02:10:14 +02:00
import java.util.Objects;
2023-01-18 01:48:54 +01:00
import java.util.Set;
2021-03-01 21:04:06 +01:00
public class SourcesGeneratorConfiguration {
public String currentVersion;
public Map<String, InterfaceDataConfiguration> interfacesData;
2023-01-18 01:48:54 +01:00
public Map<String, ClassConfiguration> baseTypesData;
public Map<String, Set<String>> superTypesData;
public Map<String, CustomTypesConfiguration> customTypesData;
2021-03-01 21:04:06 +01:00
public Map<String, VersionConfiguration> versions;
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;
}
SourcesGeneratorConfiguration that = (SourcesGeneratorConfiguration) o;
return Objects.equals(currentVersion, that.currentVersion) && Objects.equals(interfacesData, that.interfacesData)
2023-01-18 01:48:54 +01:00
&& Objects.equals(baseTypesData, that.baseTypesData) && Objects.equals(superTypesData, that.superTypesData)
&& Objects.equals(customTypesData, that.customTypesData) && Objects.equals(versions, that.versions);
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(currentVersion);
hash += ConfigUtils.hashCode(interfacesData);
2023-01-18 01:48:54 +01:00
hash += ConfigUtils.hashCode(superTypesData);
hash += ConfigUtils.hashCode(customTypesData);
2022-07-19 02:45:20 +02:00
hash += ConfigUtils.hashCode(versions);
return hash;
2022-07-19 02:10:14 +02:00
}
2023-01-18 01:48:54 +01:00
public DataModel buildDataModel() {
return new DataModel(hashCode(),
currentVersion,
Objects.requireNonNullElse(interfacesData, Map.of()),
Objects.requireNonNullElse(baseTypesData, Map.of()),
Objects.requireNonNullElse(superTypesData, Map.of()),
Objects.requireNonNullElse(customTypesData, Map.of()),
Objects.requireNonNullElse(versions, Map.of())
);
}
2021-03-01 21:04:06 +01:00
}