diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml index 535109e..2558e71 100644 --- a/.github/workflows/maven-publish.yml +++ b/.github/workflows/maven-publish.yml @@ -24,7 +24,7 @@ jobs: shell: bash run: | # ====== Variables - export REVISION=${{ github.run_number }} + export REVISION=1.0.${{ github.run_number }} echo "REVISION=$REVISION" >> $GITHUB_ENV - name: Set up JDK 17 diff --git a/.gitignore b/.gitignore index 1bcc458..104e357 100644 --- a/.gitignore +++ b/.gitignore @@ -1,67 +1,10 @@ /target/ -/database-data-builder.iml -data-generator.iml - -.metadata -bin/ -tmp/ -*.tmp -*.bak -*.swp -*~.nib -local.properties -.settings/ -.loadpath -.recommenders - -# External tool builders -.externalToolBuilders/ - -# Locally stored "Eclipse launch configurations" -*.launch - -# PyDev specific (Python IDE for Eclipse) -*.pydevproject - -# CDT-specific (C/C++ Development Tooling) -.cproject - -# CDT- autotools -.autotools - -# Java annotation processor (APT) -.factorypath - -# PDT-specific (PHP Development Tools) -.buildpath - -# sbteclipse plugin -.target - -# Tern plugin -.tern-project - -# TeXlipse plugin -.texlipse - -# STS (Spring Tool Suite) -.springBeans - -# Code Recommenders -.recommenders/ - -# Annotation Processing -.apt_generated/ -.apt_generated_test/ - -# Scala IDE specific (Scala & Java development for Eclipse) -.cache-main -.scala_dependencies -.worksheet - -.project -.classpath +*.iml .ci-friendly-pom.xml +/.classpath +/.project +/.settings/ + .flattened-pom.xml diff --git a/data-generator-plugin/.github/workflows/maven-publish.yml b/data-generator-plugin/.github/workflows/maven-publish.yml new file mode 100644 index 0000000..535109e --- /dev/null +++ b/data-generator-plugin/.github/workflows/maven-publish.yml @@ -0,0 +1,50 @@ +# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created +# For more information see: https://github.com/actions/setup-java#apache-maven-with-a-settings-path + +name: Maven Package + +on: + push: + pull_request: + schedule: + - cron: '0 0 * * 0' # weekly + +jobs: + build: + strategy: + matrix: + include: + - { os: ubuntu-20.04, arch: "linux/amd64" } + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + with: + submodules: "recursive" + - name: Setup variables + shell: bash + run: | + # ====== Variables + export REVISION=${{ github.run_number }} + + echo "REVISION=$REVISION" >> $GITHUB_ENV + - name: Set up JDK 17 + if: github.ref == 'refs/heads/master' + uses: actions/setup-java@v1 + with: + java-version: 17 + server-id: mchv-release-distribution + server-username: MAVEN_USERNAME + server-password: MAVEN_PASSWORD + env: + MAVEN_USERNAME: ${{ secrets.MCHV_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.MCHV_TOKEN }} + - name: Deploy to Maven (Release) + if: github.ref == 'refs/heads/master' + shell: bash + run: | + echo "REVISION: $REVISION" + + mvn -B -Drevision=${REVISION} clean deploy + env: + MAVEN_USERNAME: ${{ secrets.MCHV_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.MCHV_TOKEN }} diff --git a/data-generator-plugin/.gitignore b/data-generator-plugin/.gitignore new file mode 100644 index 0000000..1bcc458 --- /dev/null +++ b/data-generator-plugin/.gitignore @@ -0,0 +1,67 @@ +/target/ +/database-data-builder.iml +data-generator.iml + +.metadata +bin/ +tmp/ +*.tmp +*.bak +*.swp +*~.nib +local.properties +.settings/ +.loadpath +.recommenders + +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch + +# PyDev specific (Python IDE for Eclipse) +*.pydevproject + +# CDT-specific (C/C++ Development Tooling) +.cproject + +# CDT- autotools +.autotools + +# Java annotation processor (APT) +.factorypath + +# PDT-specific (PHP Development Tools) +.buildpath + +# sbteclipse plugin +.target + +# Tern plugin +.tern-project + +# TeXlipse plugin +.texlipse + +# STS (Spring Tool Suite) +.springBeans + +# Code Recommenders +.recommenders/ + +# Annotation Processing +.apt_generated/ +.apt_generated_test/ + +# Scala IDE specific (Scala & Java development for Eclipse) +.cache-main +.scala_dependencies +.worksheet + +.project +.classpath + +.ci-friendly-pom.xml + +.flattened-pom.xml diff --git a/data-generator-plugin/README.md b/data-generator-plugin/README.md new file mode 100644 index 0000000..2ef0b0e --- /dev/null +++ b/data-generator-plugin/README.md @@ -0,0 +1,15 @@ +Data generator +============== +Maven plugin to generate upgradable data classes and serializers from a .yaml definition file. + +It can be also executed standalone. + +The data is serializable and upgradable from any version to the latest. + +The transformations between each version are defined in the .yaml file itself. + +Supports custom (external) data types, custom data arrays, custom data optionals, +interfaces with common getters / setters. + +The serialized data is very lightweight: it serializes only the data, without any metadata or type specification, +because it's all deducted on compile-time from the definitions file. diff --git a/data-generator-plugin/pom.xml b/data-generator-plugin/pom.xml new file mode 100644 index 0000000..5a27a67 --- /dev/null +++ b/data-generator-plugin/pom.xml @@ -0,0 +1,274 @@ + + + 4.0.0 + + Data generator + data-generator-plugin + ${revision} + maven-plugin + + it.cavallium + ${revision} + data-generator + + + 1.0.0.0-SNAPSHOT + UTF-8 + + + + mchv-release + MCHV Release Apache Maven Packages + https://mvn.mchv.eu/repository/mchv + + + mchv-snapshot + MCHV Snapshot Apache Maven Packages + https://mvn.mchv.eu/repository/mchv-snapshot + + + + + mchv-release-distribution + MCHV Release Apache Maven Packages Distribution + https://mvn.mchv.eu/repository/mchv + + + mchv-snapshot-distribution + MCHV Snapshot Apache Maven Packages Distribution + https://mvn.mchv.eu/repository/mchv-snapshot + + + + scm:git:https://git.ignuranza.net/andreacavalli/data-generator.git + scm:git:https://git.ignuranza.net/andreacavalli/data-generator.git + HEAD + + + + + + org.apache.maven.plugins + maven-plugin-plugin + 3.6.1 + + + org.apache.maven.plugin-tools + maven-plugin-tools-annotations + 3.6.1 + + + + + maven-surefire-plugin + 3.0.0-M5 + + + org.junit.jupiter + junit-jupiter-engine + 5.9.0 + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 17 + UTF-8 + + + + org.codehaus.mojo + flatten-maven-plugin + 1.1.0 + + true + oss + + resolve + resolve + resolve + + + + + flatten + process-resources + + flatten + + + + flatten.clean + clean + + clean + + + + + + + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + + org.apache.maven.plugins + + + maven-plugin-plugin + + + [3.6.1,) + + + descriptor + + + + + + + + + + org.codehaus.mojo + + + flatten-maven-plugin + + + [1.1.0,) + + + flatten + + + + + + + + + + + + + + + + + commons-io + commons-io + 2.11.0 + + + org.yaml + snakeyaml + 1.33 + + + com.squareup + javapoet + 1.14.0-records + + + org.jetbrains + annotations + 23.0.0 + + + it.unimi.dsi + fastutil + 8.5.11 + + + org.apache.maven + maven-core + 3.8.5 + provided + + + org.apache.maven + maven-plugin-api + 3.8.5 + provided + + + org.apache.maven.plugin-tools + maven-plugin-annotations + 3.6.4 + provided + + + org.apache.maven + maven-project + 2.2.1 + + + junit + junit + + + + + io.soabase.record-builder + record-builder-core + 34 + + + org.slf4j + slf4j-api + 2.0.3 + + + org.apache.logging.log4j + log4j-core + 2.19.0 + + + org.apache.logging.log4j + log4j-slf4j2-impl + 2.19.0 + + + junit + junit + + + org.hamcrest + hamcrest-core + + + + + org.junit.jupiter + junit-jupiter-api + 5.9.0 + test + + + org.hamcrest + hamcrest-core + + + + + it.cavallium + data-generator-runtime + ${revision} + + + \ No newline at end of file diff --git a/src/main/java/it/cavallium/data/generator/ClassConfiguration.java b/data-generator-plugin/src/main/java/it/cavallium/data/generator/ClassConfiguration.java similarity index 100% rename from src/main/java/it/cavallium/data/generator/ClassConfiguration.java rename to data-generator-plugin/src/main/java/it/cavallium/data/generator/ClassConfiguration.java diff --git a/src/main/java/it/cavallium/data/generator/ConfigUtils.java b/data-generator-plugin/src/main/java/it/cavallium/data/generator/ConfigUtils.java similarity index 100% rename from src/main/java/it/cavallium/data/generator/ConfigUtils.java rename to data-generator-plugin/src/main/java/it/cavallium/data/generator/ConfigUtils.java diff --git a/src/main/java/it/cavallium/data/generator/CustomTypesConfiguration.java b/data-generator-plugin/src/main/java/it/cavallium/data/generator/CustomTypesConfiguration.java similarity index 100% rename from src/main/java/it/cavallium/data/generator/CustomTypesConfiguration.java rename to data-generator-plugin/src/main/java/it/cavallium/data/generator/CustomTypesConfiguration.java diff --git a/src/main/java/it/cavallium/data/generator/DetailsConfiguration.java b/data-generator-plugin/src/main/java/it/cavallium/data/generator/DetailsConfiguration.java similarity index 100% rename from src/main/java/it/cavallium/data/generator/DetailsConfiguration.java rename to data-generator-plugin/src/main/java/it/cavallium/data/generator/DetailsConfiguration.java diff --git a/src/main/java/it/cavallium/data/generator/InterfaceDataConfiguration.java b/data-generator-plugin/src/main/java/it/cavallium/data/generator/InterfaceDataConfiguration.java similarity index 100% rename from src/main/java/it/cavallium/data/generator/InterfaceDataConfiguration.java rename to data-generator-plugin/src/main/java/it/cavallium/data/generator/InterfaceDataConfiguration.java diff --git a/src/main/java/it/cavallium/data/generator/MavenPlugin.java b/data-generator-plugin/src/main/java/it/cavallium/data/generator/MavenPlugin.java similarity index 100% rename from src/main/java/it/cavallium/data/generator/MavenPlugin.java rename to data-generator-plugin/src/main/java/it/cavallium/data/generator/MavenPlugin.java diff --git a/src/main/java/it/cavallium/data/generator/MoveDataConfiguration.java b/data-generator-plugin/src/main/java/it/cavallium/data/generator/MoveDataConfiguration.java similarity index 100% rename from src/main/java/it/cavallium/data/generator/MoveDataConfiguration.java rename to data-generator-plugin/src/main/java/it/cavallium/data/generator/MoveDataConfiguration.java diff --git a/src/main/java/it/cavallium/data/generator/NewDataConfiguration.java b/data-generator-plugin/src/main/java/it/cavallium/data/generator/NewDataConfiguration.java similarity index 100% rename from src/main/java/it/cavallium/data/generator/NewDataConfiguration.java rename to data-generator-plugin/src/main/java/it/cavallium/data/generator/NewDataConfiguration.java diff --git a/src/main/java/it/cavallium/data/generator/RemoveDataConfiguration.java b/data-generator-plugin/src/main/java/it/cavallium/data/generator/RemoveDataConfiguration.java similarity index 100% rename from src/main/java/it/cavallium/data/generator/RemoveDataConfiguration.java rename to data-generator-plugin/src/main/java/it/cavallium/data/generator/RemoveDataConfiguration.java diff --git a/src/main/java/it/cavallium/data/generator/SerializeCodeBlockGenerator.java b/data-generator-plugin/src/main/java/it/cavallium/data/generator/SerializeCodeBlockGenerator.java similarity index 100% rename from src/main/java/it/cavallium/data/generator/SerializeCodeBlockGenerator.java rename to data-generator-plugin/src/main/java/it/cavallium/data/generator/SerializeCodeBlockGenerator.java diff --git a/src/main/java/it/cavallium/data/generator/SourcesGenerator.java b/data-generator-plugin/src/main/java/it/cavallium/data/generator/SourcesGenerator.java similarity index 100% rename from src/main/java/it/cavallium/data/generator/SourcesGenerator.java rename to data-generator-plugin/src/main/java/it/cavallium/data/generator/SourcesGenerator.java diff --git a/src/main/java/it/cavallium/data/generator/SourcesGeneratorConfiguration.java b/data-generator-plugin/src/main/java/it/cavallium/data/generator/SourcesGeneratorConfiguration.java similarity index 100% rename from src/main/java/it/cavallium/data/generator/SourcesGeneratorConfiguration.java rename to data-generator-plugin/src/main/java/it/cavallium/data/generator/SourcesGeneratorConfiguration.java diff --git a/src/main/java/it/cavallium/data/generator/SourcesGeneratorConfigurationRefs.java b/data-generator-plugin/src/main/java/it/cavallium/data/generator/SourcesGeneratorConfigurationRefs.java similarity index 100% rename from src/main/java/it/cavallium/data/generator/SourcesGeneratorConfigurationRefs.java rename to data-generator-plugin/src/main/java/it/cavallium/data/generator/SourcesGeneratorConfigurationRefs.java diff --git a/src/main/java/it/cavallium/data/generator/Standalone.java b/data-generator-plugin/src/main/java/it/cavallium/data/generator/Standalone.java similarity index 100% rename from src/main/java/it/cavallium/data/generator/Standalone.java rename to data-generator-plugin/src/main/java/it/cavallium/data/generator/Standalone.java diff --git a/src/main/java/it/cavallium/data/generator/TransformationConfiguration.java b/data-generator-plugin/src/main/java/it/cavallium/data/generator/TransformationConfiguration.java similarity index 100% rename from src/main/java/it/cavallium/data/generator/TransformationConfiguration.java rename to data-generator-plugin/src/main/java/it/cavallium/data/generator/TransformationConfiguration.java diff --git a/src/main/java/it/cavallium/data/generator/UpgradeDataConfiguration.java b/data-generator-plugin/src/main/java/it/cavallium/data/generator/UpgradeDataConfiguration.java similarity index 100% rename from src/main/java/it/cavallium/data/generator/UpgradeDataConfiguration.java rename to data-generator-plugin/src/main/java/it/cavallium/data/generator/UpgradeDataConfiguration.java diff --git a/src/main/java/it/cavallium/data/generator/VersionConfiguration.java b/data-generator-plugin/src/main/java/it/cavallium/data/generator/VersionConfiguration.java similarity index 100% rename from src/main/java/it/cavallium/data/generator/VersionConfiguration.java rename to data-generator-plugin/src/main/java/it/cavallium/data/generator/VersionConfiguration.java diff --git a/src/main/java/it/cavallium/data/generator/VersionTransformation.java b/data-generator-plugin/src/main/java/it/cavallium/data/generator/VersionTransformation.java similarity index 100% rename from src/main/java/it/cavallium/data/generator/VersionTransformation.java rename to data-generator-plugin/src/main/java/it/cavallium/data/generator/VersionTransformation.java diff --git a/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml b/data-generator-plugin/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml similarity index 100% rename from src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml rename to data-generator-plugin/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml diff --git a/data-generator-runtime/.github/workflows/maven-publish.yml b/data-generator-runtime/.github/workflows/maven-publish.yml new file mode 100644 index 0000000..535109e --- /dev/null +++ b/data-generator-runtime/.github/workflows/maven-publish.yml @@ -0,0 +1,50 @@ +# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created +# For more information see: https://github.com/actions/setup-java#apache-maven-with-a-settings-path + +name: Maven Package + +on: + push: + pull_request: + schedule: + - cron: '0 0 * * 0' # weekly + +jobs: + build: + strategy: + matrix: + include: + - { os: ubuntu-20.04, arch: "linux/amd64" } + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + with: + submodules: "recursive" + - name: Setup variables + shell: bash + run: | + # ====== Variables + export REVISION=${{ github.run_number }} + + echo "REVISION=$REVISION" >> $GITHUB_ENV + - name: Set up JDK 17 + if: github.ref == 'refs/heads/master' + uses: actions/setup-java@v1 + with: + java-version: 17 + server-id: mchv-release-distribution + server-username: MAVEN_USERNAME + server-password: MAVEN_PASSWORD + env: + MAVEN_USERNAME: ${{ secrets.MCHV_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.MCHV_TOKEN }} + - name: Deploy to Maven (Release) + if: github.ref == 'refs/heads/master' + shell: bash + run: | + echo "REVISION: $REVISION" + + mvn -B -Drevision=${REVISION} clean deploy + env: + MAVEN_USERNAME: ${{ secrets.MCHV_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.MCHV_TOKEN }} diff --git a/data-generator-runtime/.gitignore b/data-generator-runtime/.gitignore new file mode 100644 index 0000000..b18f076 --- /dev/null +++ b/data-generator-runtime/.gitignore @@ -0,0 +1,10 @@ +/target/ +*.iml + +.ci-friendly-pom.xml + +/.classpath +/.project +/.settings/ + +.flattened-pom.xml diff --git a/data-generator-runtime/README.md b/data-generator-runtime/README.md new file mode 100644 index 0000000..0e45e7c --- /dev/null +++ b/data-generator-runtime/README.md @@ -0,0 +1,3 @@ +Data generator runtime +====================== +Dependency of data-generator \ No newline at end of file diff --git a/data-generator-runtime/pom.xml b/data-generator-runtime/pom.xml new file mode 100644 index 0000000..1a8ca6b --- /dev/null +++ b/data-generator-runtime/pom.xml @@ -0,0 +1,188 @@ + + + 4.0.0 + + Data generator runtime + data-generator-runtime + ${revision} + jar + + it.cavallium + ${revision} + data-generator + ../pom.xml + + + 1.0.0.0-SNAPSHOT + UTF-8 + + + + mchv-release + MCHV Release Apache Maven Packages + https://mvn.mchv.eu/repository/mchv + + + mchv-snapshot + MCHV Snapshot Apache Maven Packages + https://mvn.mchv.eu/repository/mchv-snapshot + + + + + mchv-release-distribution + MCHV Release Apache Maven Packages Distribution + https://mvn.mchv.eu/repository/mchv + + + mchv-snapshot-distribution + MCHV Snapshot Apache Maven Packages Distribution + https://mvn.mchv.eu/repository/mchv-snapshot + + + + scm:git:https://git.ignuranza.net/andreacavalli/data-generator-runtime.git + scm:git:https://git.ignuranza.net/andreacavalli/data-generator-runtime.git + + HEAD + + + + + + maven-surefire-plugin + 3.0.0-M5 + + + org.junit.jupiter + junit-jupiter-engine + 5.9.0 + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 17 + UTF-8 + + + + org.codehaus.mojo + flatten-maven-plugin + 1.1.0 + + true + oss + + resolve + resolve + resolve + + + + + flatten + process-resources + + flatten + + + + flatten.clean + clean + + clean + + + + + + + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + + org.codehaus.mojo + + + flatten-maven-plugin + + + [1.1.0,) + + + flatten + + + + + + + + + + + + + + + + + org.jetbrains + annotations + + + it.unimi.dsi + fastutil + + + org.junit.jupiter + junit-jupiter-api + test + + + org.hamcrest + hamcrest-core + + + + + + + + org.jetbrains + annotations + 23.0.0 + + + it.unimi.dsi + fastutil + 8.5.11 + + + org.junit.jupiter + junit-jupiter-api + 5.9.0 + + + org.hamcrest + hamcrest-core + + + + + + \ No newline at end of file diff --git a/data-generator-runtime/src/main/java/it/cavallium/data/generator/CommonField.java b/data-generator-runtime/src/main/java/it/cavallium/data/generator/CommonField.java new file mode 100644 index 0000000..9b6b1fa --- /dev/null +++ b/data-generator-runtime/src/main/java/it/cavallium/data/generator/CommonField.java @@ -0,0 +1,13 @@ +package it.cavallium.data.generator; + +public class CommonField { + public final String fieldName; + public final String fieldType; + public final boolean hasSetter; + + public CommonField(String fieldName, String fieldType, boolean hasSetter) { + this.fieldName = fieldName; + this.fieldType = fieldType; + this.hasSetter = hasSetter; + } +} diff --git a/data-generator-runtime/src/main/java/it/cavallium/data/generator/DataInitializer.java b/data-generator-runtime/src/main/java/it/cavallium/data/generator/DataInitializer.java new file mode 100644 index 0000000..493853d --- /dev/null +++ b/data-generator-runtime/src/main/java/it/cavallium/data/generator/DataInitializer.java @@ -0,0 +1,9 @@ +package it.cavallium.data.generator; + +import java.io.IOException; +import org.jetbrains.annotations.NotNull; + +public interface DataInitializer { + + @NotNull T initialize() throws IOException; +} diff --git a/data-generator-runtime/src/main/java/it/cavallium/data/generator/DataSerializer.java b/data-generator-runtime/src/main/java/it/cavallium/data/generator/DataSerializer.java new file mode 100644 index 0000000..dd363fa --- /dev/null +++ b/data-generator-runtime/src/main/java/it/cavallium/data/generator/DataSerializer.java @@ -0,0 +1,14 @@ +package it.cavallium.data.generator; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +public interface DataSerializer { + + void serialize(DataOutput dataOutput, @NotNull T data) throws IOException; + + @NotNull T deserialize(DataInput dataInput) throws IOException; +} diff --git a/data-generator-runtime/src/main/java/it/cavallium/data/generator/DataUpgrader.java b/data-generator-runtime/src/main/java/it/cavallium/data/generator/DataUpgrader.java new file mode 100644 index 0000000..d6e3f61 --- /dev/null +++ b/data-generator-runtime/src/main/java/it/cavallium/data/generator/DataUpgrader.java @@ -0,0 +1,9 @@ +package it.cavallium.data.generator; + +import java.io.IOException; +import org.jetbrains.annotations.NotNull; + +public interface DataUpgrader { + + @NotNull U upgrade(@NotNull T data) throws IOException; +} diff --git a/data-generator-runtime/src/main/java/it/cavallium/data/generator/NativeNullable.java b/data-generator-runtime/src/main/java/it/cavallium/data/generator/NativeNullable.java new file mode 100644 index 0000000..e126b89 --- /dev/null +++ b/data-generator-runtime/src/main/java/it/cavallium/data/generator/NativeNullable.java @@ -0,0 +1,24 @@ +package it.cavallium.data.generator; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +public interface NativeNullable { + + boolean isEmpty(); + + default boolean isPresent() { + return !isEmpty(); + } + + @NotNull + T orElse(@NotNull T defaultValue); + + @NotNull NativeNullable or(@NotNull NativeNullable fallback); + + @Nullable + T getNullable(); + + @Nullable + T getNullable(@Nullable T defaultValue); +} diff --git a/data-generator-runtime/src/main/java/it/cavallium/data/generator/TypedNullable.java b/data-generator-runtime/src/main/java/it/cavallium/data/generator/TypedNullable.java new file mode 100644 index 0000000..86d6417 --- /dev/null +++ b/data-generator-runtime/src/main/java/it/cavallium/data/generator/TypedNullable.java @@ -0,0 +1,118 @@ +package it.cavallium.data.generator; + +import java.util.Objects; +import java.util.Optional; +import java.util.function.Function; +import java.util.function.Predicate; +import java.util.function.Supplier; +import java.util.stream.Stream; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +public interface TypedNullable extends NativeNullable { + + @NotNull + default T get() throws NullPointerException { + var value = getNullable(); + if (value == null) { + throw new NullPointerException(); + } else { + return value; + } + } + + @Override + default @Nullable T getNullable(@Nullable T defaultValue) { + var value = getNullable(); + return value == null ? defaultValue : value; + } + + @Override + default @NotNull T orElse(@NotNull T defaultValue) { + var value = getNullable(); + if (value == null) { + Objects.requireNonNull(defaultValue, "default value must not be null"); + return defaultValue; + } else { + return value; + } + } + + @Override + default @NotNull NativeNullable or(@NotNull NativeNullable fallback) { + var value = getNullable(); + if (value == null) { + return fallback; + } else { + return this; + } + } + + @Override + default boolean isPresent() { + return getNullable() != null; + } + + @Override + default boolean isEmpty() { + return getNullable() == null; + } + + default > @NotNull TN map( + @NotNull Function<@NotNull T, @NotNull U> value, + @NotNull Function<@Nullable U, @NotNull TN> nullableConstructor) { + var nullable = getNullable(); + if (nullable != null) { + var val = value.apply(nullable); + Objects.requireNonNull(val, "Mapped value must not be null"); + return nullableConstructor.apply(val); + } else { + return nullableConstructor.apply(null); + } + } + + default @NotNull Optional map(@NotNull Function<@NotNull T, @NotNull U> value) { + var nullable = getNullable(); + if (nullable != null) { + var val = value.apply(nullable); + return Optional.of(val); + } else { + return Optional.empty(); + } + } + + @SuppressWarnings("unchecked") + default > @NotNull TN filter( + @NotNull Predicate<@NotNull T> value, + @NotNull Supplier nullableConstructor) { + var nullable = getNullable(); + if (nullable != null) { + var filter = value.test(nullable); + if (!filter) { + return nullableConstructor.get(); + } + } + return (TN) this; + } + + default @NotNull Optional filter(@NotNull Predicate<@NotNull T> value) { + var nullable = getNullable(); + if (nullable != null) { + var filter = value.test(nullable); + if (!filter) { + return Optional.empty(); + } + } + return Optional.ofNullable(nullable); + } + + default @NotNull Optional toOptional() { + var nullable = getNullable(); + return Optional.ofNullable(nullable); + } + + default @NotNull Stream stream() { + var nullable = getNullable(); + return Stream.ofNullable(nullable); + } +} diff --git a/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/ArrayInt52Serializer.java b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/ArrayInt52Serializer.java new file mode 100644 index 0000000..03a66ca --- /dev/null +++ b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/ArrayInt52Serializer.java @@ -0,0 +1,29 @@ +package it.cavallium.data.generator.nativedata; + +import it.cavallium.data.generator.DataSerializer; +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import java.util.List; +import org.jetbrains.annotations.NotNull; + +public class ArrayInt52Serializer implements DataSerializer< List> { + + @Override + public void serialize(DataOutput dataOutput, List data) throws IOException { + dataOutput.writeInt(data.size()); + for (Int52 datum : data) { + Int52Serializer.INSTANCE.serialize(dataOutput, datum); + } + } + + @NotNull + @Override + public List deserialize(DataInput dataInput) throws IOException { + var data = new Int52[dataInput.readInt()]; + for (int i = 0; i < data.length; i++) { + data[i] = Int52Serializer.INSTANCE.deserialize(dataInput); + } + return List.of(data); + } +} diff --git a/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/ArrayStringSerializer.java b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/ArrayStringSerializer.java new file mode 100644 index 0000000..d4aa6a1 --- /dev/null +++ b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/ArrayStringSerializer.java @@ -0,0 +1,29 @@ +package it.cavallium.data.generator.nativedata; + +import it.cavallium.data.generator.DataSerializer; +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import java.util.List; +import org.jetbrains.annotations.NotNull; + +public class ArrayStringSerializer implements DataSerializer> { + + @Override + public void serialize(DataOutput dataOutput, @NotNull List data) throws IOException { + dataOutput.writeInt(data.size()); + for (int i = 0; i < data.size(); i++) { + dataOutput.writeUTF(data.get(i)); + } + } + + @NotNull + @Override + public List deserialize(DataInput dataInput) throws IOException { + var data = new String[dataInput.readInt()]; + for (int i = 0; i < data.length; i++) { + data[i] = dataInput.readUTF(); + } + return List.of(data); + } +} diff --git a/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/ArraybooleanSerializer.java b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/ArraybooleanSerializer.java new file mode 100644 index 0000000..e80357c --- /dev/null +++ b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/ArraybooleanSerializer.java @@ -0,0 +1,29 @@ +package it.cavallium.data.generator.nativedata; + +import it.cavallium.data.generator.DataSerializer; +import it.unimi.dsi.fastutil.booleans.BooleanList; +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import org.jetbrains.annotations.NotNull; + +public class ArraybooleanSerializer implements DataSerializer { + + @Override + public void serialize(DataOutput dataOutput, @NotNull BooleanList data) throws IOException { + dataOutput.writeInt(data.size()); + for (int i = 0; i < data.size(); i++) { + dataOutput.writeBoolean(data.getBoolean(i)); + } + } + + @NotNull + @Override + public BooleanList deserialize(DataInput dataInput) throws IOException { + var data = new boolean[dataInput.readInt()]; + for (int i = 0; i < data.length; i++) { + data[i] = dataInput.readBoolean(); + } + return BooleanList.of(data); + } +} diff --git a/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/ArraybyteSerializer.java b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/ArraybyteSerializer.java new file mode 100644 index 0000000..f5bff1e --- /dev/null +++ b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/ArraybyteSerializer.java @@ -0,0 +1,29 @@ +package it.cavallium.data.generator.nativedata; + +import it.cavallium.data.generator.DataSerializer; +import it.unimi.dsi.fastutil.bytes.ByteList; +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import org.jetbrains.annotations.NotNull; + +public class ArraybyteSerializer implements DataSerializer { + + @Override + public void serialize(DataOutput dataOutput, @NotNull ByteList data) throws IOException { + dataOutput.writeInt(data.size()); + for (int i = 0; i < data.size(); i++) { + dataOutput.writeByte(data.getByte(i)); + } + } + + @NotNull + @Override + public ByteList deserialize(DataInput dataInput) throws IOException { + var data = new byte[dataInput.readInt()]; + for (int i = 0; i < data.length; i++) { + data[i] = dataInput.readByte(); + } + return ByteList.of(data); + } +} diff --git a/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/ArraycharSerializer.java b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/ArraycharSerializer.java new file mode 100644 index 0000000..e1b37e2 --- /dev/null +++ b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/ArraycharSerializer.java @@ -0,0 +1,29 @@ +package it.cavallium.data.generator.nativedata; + +import it.cavallium.data.generator.DataSerializer; +import it.unimi.dsi.fastutil.chars.CharList; +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import org.jetbrains.annotations.NotNull; + +public class ArraycharSerializer implements DataSerializer { + + @Override + public void serialize(DataOutput dataOutput, @NotNull CharList data) throws IOException { + dataOutput.writeInt(data.size()); + for (int i = 0; i < data.size(); i++) { + dataOutput.writeChar(data.getChar(i)); + } + } + + @NotNull + @Override + public CharList deserialize(DataInput dataInput) throws IOException { + var data = new char[dataInput.readInt()]; + for (int i = 0; i < data.length; i++) { + data[i] = dataInput.readChar(); + } + return CharList.of(data); + } +} diff --git a/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/ArraydoubleSerializer.java b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/ArraydoubleSerializer.java new file mode 100644 index 0000000..8c99145 --- /dev/null +++ b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/ArraydoubleSerializer.java @@ -0,0 +1,29 @@ +package it.cavallium.data.generator.nativedata; + +import it.cavallium.data.generator.DataSerializer; +import it.unimi.dsi.fastutil.doubles.DoubleList; +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import org.jetbrains.annotations.NotNull; + +public class ArraydoubleSerializer implements DataSerializer { + + @Override + public void serialize(DataOutput dataOutput, @NotNull DoubleList data) throws IOException { + dataOutput.writeInt(data.size()); + for (int i = 0; i < data.size(); i++) { + dataOutput.writeDouble(data.getDouble(i)); + } + } + + @NotNull + @Override + public DoubleList deserialize(DataInput dataInput) throws IOException { + var data = new double[dataInput.readInt()]; + for (int i = 0; i < data.length; i++) { + data[i] = dataInput.readDouble(); + } + return DoubleList.of(data); + } +} diff --git a/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/ArrayfloatSerializer.java b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/ArrayfloatSerializer.java new file mode 100644 index 0000000..712f6ba --- /dev/null +++ b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/ArrayfloatSerializer.java @@ -0,0 +1,29 @@ +package it.cavallium.data.generator.nativedata; + +import it.cavallium.data.generator.DataSerializer; +import it.unimi.dsi.fastutil.floats.FloatList; +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import org.jetbrains.annotations.NotNull; + +public class ArrayfloatSerializer implements DataSerializer { + + @Override + public void serialize(DataOutput dataOutput, @NotNull FloatList data) throws IOException { + dataOutput.writeInt(data.size()); + for (int i = 0; i < data.size(); i++) { + dataOutput.writeFloat(data.getFloat(i)); + } + } + + @NotNull + @Override + public FloatList deserialize(DataInput dataInput) throws IOException { + var data = new float[dataInput.readInt()]; + for (int i = 0; i < data.length; i++) { + data[i] = dataInput.readFloat(); + } + return FloatList.of(data); + } +} diff --git a/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/ArrayintSerializer.java b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/ArrayintSerializer.java new file mode 100644 index 0000000..fdf3739 --- /dev/null +++ b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/ArrayintSerializer.java @@ -0,0 +1,29 @@ +package it.cavallium.data.generator.nativedata; + +import it.cavallium.data.generator.DataSerializer; +import it.unimi.dsi.fastutil.ints.IntList; +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import org.jetbrains.annotations.NotNull; + +public class ArrayintSerializer implements DataSerializer { + + @Override + public void serialize(DataOutput dataOutput, @NotNull IntList data) throws IOException { + dataOutput.writeInt(data.size()); + for (int i = 0; i < data.size(); i++) { + dataOutput.writeInt(data.getInt(i)); + } + } + + @NotNull + @Override + public IntList deserialize(DataInput dataInput) throws IOException { + var data = new int[dataInput.readInt()]; + for (int i = 0; i < data.length; i++) { + data[i] = dataInput.readInt(); + } + return IntList.of(data); + } +} diff --git a/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/ArraylongSerializer.java b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/ArraylongSerializer.java new file mode 100644 index 0000000..1b93e28 --- /dev/null +++ b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/ArraylongSerializer.java @@ -0,0 +1,29 @@ +package it.cavallium.data.generator.nativedata; + +import it.cavallium.data.generator.DataSerializer; +import it.unimi.dsi.fastutil.longs.LongList; +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import org.jetbrains.annotations.NotNull; + +public class ArraylongSerializer implements DataSerializer { + + @Override + public void serialize(DataOutput dataOutput, @NotNull LongList data) throws IOException { + dataOutput.writeInt(data.size()); + for (int i = 0; i < data.size(); i++) { + dataOutput.writeLong(data.getLong(i)); + } + } + + @NotNull + @Override + public LongList deserialize(DataInput dataInput) throws IOException { + var data = new long[dataInput.readInt()]; + for (int i = 0; i < data.length; i++) { + data[i] = dataInput.readLong(); + } + return LongList.of(data); + } +} diff --git a/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/ArrayshortSerializer.java b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/ArrayshortSerializer.java new file mode 100644 index 0000000..a1e43b2 --- /dev/null +++ b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/ArrayshortSerializer.java @@ -0,0 +1,29 @@ +package it.cavallium.data.generator.nativedata; + +import it.cavallium.data.generator.DataSerializer; +import it.unimi.dsi.fastutil.shorts.ShortList; +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import org.jetbrains.annotations.NotNull; + +public class ArrayshortSerializer implements DataSerializer { + + @Override + public void serialize(DataOutput dataOutput, @NotNull ShortList data) throws IOException { + dataOutput.writeInt(data.size()); + for (int i = 0; i < data.size(); i++) { + dataOutput.writeShort(data.getShort(i)); + } + } + + @NotNull + @Override + public ShortList deserialize(DataInput dataInput) throws IOException { + var data = new short[dataInput.readInt()]; + for (int i = 0; i < data.length; i++) { + data[i] = dataInput.readShort(); + } + return ShortList.of(data); + } +} diff --git a/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/IGenericNullable.java b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/IGenericNullable.java new file mode 100644 index 0000000..e36a670 --- /dev/null +++ b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/IGenericNullable.java @@ -0,0 +1,5 @@ +package it.cavallium.data.generator.nativedata; + +public interface IGenericNullable { + Object $getNullable(); +} diff --git a/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/Int52.java b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/Int52.java new file mode 100644 index 0000000..2af94c1 --- /dev/null +++ b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/Int52.java @@ -0,0 +1,101 @@ +package it.cavallium.data.generator.nativedata; + +import java.lang.annotation.Native; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +public class Int52 extends Number implements Comparable { + + /** + * The number of bits used to represent a {@code Int52} value in two's + * complement binary form. + */ + @Native + public static final int SIZE = 52; + + /** + * The number of bytes used to represent a {@code Int52} value in two's + * complement binary form. + */ + public static final int BYTES = 7; + + public static final Int52 ZERO = new Int52(0L); + public static final Int52 ONE = new Int52(1L); + public static final Int52 TWO = new Int52(2L); + public static final Int52 TEN = new Int52(10L); + + private final long value; + + private Int52(long value) { + this.value = value; + } + + public static Int52 fromLong(long value) { + if (value == 0) { + return ZERO; + } else if (value == 1) { + return ONE; + } else if (value == 2) { + return TWO; + } else if (value == 10) { + return TEN; + } else if (value <= 0) { + throw new IllegalArgumentException("Only positive values are supported"); + } else if (value > 0x0F_FF_FF_FF_FF_FF_FFL) { + throw new IllegalArgumentException("Only values below or equal to " + 0xFFFFFFFFFFFFFL + " are supported"); + } else { + return new Int52(value); + } + } + + long getValue() { + return value; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Int52 int52 = (Int52) o; + return value == int52.value; + } + + @Override + public int hashCode() { + return Long.hashCode(value); + } + + @Override + public String toString() { + return Long.toString(value); + } + + @Override + public int intValue() { + return (int) value; + } + + @Override + public long longValue() { + return value; + } + + @Override + public float floatValue() { + return (float) value; + } + + @Override + public double doubleValue() { + return (double) value; + } + + @Override + public int compareTo(@NotNull Int52 o) { + return Long.compareUnsigned(this.value, o.value); + } +} diff --git a/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/Int52Serializer.java b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/Int52Serializer.java new file mode 100644 index 0000000..efa0260 --- /dev/null +++ b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/Int52Serializer.java @@ -0,0 +1,67 @@ +package it.cavallium.data.generator.nativedata; + +import it.cavallium.data.generator.DataSerializer; +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import org.jetbrains.annotations.NotNull; + +public class Int52Serializer implements DataSerializer { + + public static final Int52Serializer INSTANCE = new Int52Serializer(); + + @Override + public void serialize(DataOutput dataOutput, @NotNull Int52 data) throws IOException { + serializeValue(dataOutput, data); + } + + @NotNull + @Override + public Int52 deserialize(DataInput dataInput) throws IOException { + return deserializeValue(dataInput); + } + + public static void serializeValue(DataOutput dataOutput, @NotNull Int52 data) throws IOException { + long value = data.getValue(); + + for(int i = 0; i < 7; i++) { + dataOutput.writeByte(((int)((value >> (6 - i) * 8) & (i == 0 ? 0b00001111L : 255L)))); + } + } + + public static Int52 deserializeValue(DataInput dataInput) throws IOException { + long value = 0; + + return Int52.fromLong( + ((long) dataInput.readUnsignedByte() & 0b00001111) << 48 + | ((long) dataInput.readUnsignedByte()) << 40 + | ((long) dataInput.readUnsignedByte() << 32) + | ((long) dataInput.readUnsignedByte() << 24) + | ((long) dataInput.readUnsignedByte()) << 16 + | ((long) dataInput.readUnsignedByte()) << 8 + | ((long) dataInput.readUnsignedByte()) + ); + } + + public static byte[] toByteArray(long value) { + byte[] result = new byte[7]; + + for(int i = 6; i >= 0; --i) { + result[i] = (byte)((int)(value & (i == 0 ? 0b00001111L : 255L))); + value >>= 8; + } + + return result; + } + + public static long fromByteArray(byte[] bytes) { + if (bytes.length != 7) { + throw new IllegalArgumentException("Size must be 7, got " + bytes.length + " instead"); + } + return fromBytes((byte) (bytes[0] & 0b00001111), bytes[1], bytes[2], bytes[3], bytes[4], bytes[5], bytes[6]); + } + + public static long fromBytes(byte b1, byte b2, byte b3, byte b4, byte b5, byte b6, byte b7) { + return ((long)b1 & 0b00001111) << 48 | ((long)b2 & 255L) << 40 | ((long)b3 & 255L) << 32 | ((long)b4 & 255L) << 24 | ((long)b5 & 255L) << 16 | ((long)b6 & 255L) << 8 | (long)b7 & 255L; + } +} diff --git a/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/NullableInt52.java b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/NullableInt52.java new file mode 100644 index 0000000..8ed3e3f --- /dev/null +++ b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/NullableInt52.java @@ -0,0 +1,137 @@ +package it.cavallium.data.generator.nativedata; + +import it.cavallium.data.generator.NativeNullable; +import it.cavallium.data.generator.TypedNullable; +import java.io.Serial; +import java.io.Serializable; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +public class NullableInt52 implements Serializable, IGenericNullable, TypedNullable { + + @Serial + private static final long serialVersionUID = 1L; + private static final NullableInt52 NULL = new NullableInt52(null); + + private final Int52 value; + + public NullableInt52(Int52 value) { + this.value = value; + } + + public static NullableInt52 of(@NotNull Int52 value) { + return new NullableInt52(value); + } + + public static NullableInt52 ofNullable(@Nullable Int52 value) { + if (value == null) { + return NULL; + } else { + return new NullableInt52(value); + } + } + + public static NullableInt52 ofNullableNumber(@Nullable Number value) { + if (value == null) { + return NULL; + } else { + return new NullableInt52(Int52.fromLong(value.longValue())); + } + } + + public static NullableInt52 empty() { + return NULL; + } + + @Override + public boolean isEmpty() { + return value == null; + } + + @Override + public boolean isPresent() { + return value != null; + } + + @Override + @NotNull + public Int52 get() { + if (value == null) { + throw new NullPointerException(); + } else { + return value; + } + } + + @Override + public @NotNull NullableInt52 or(@NotNull NativeNullable fallback) { + if (value == null) { + if (fallback.getClass() == NullableInt52.class) { + return (NullableInt52) fallback; + } else { + return ofNullable(fallback.getNullable()); + } + } else { + return this; + } + } + + @NotNull + public NullableInt52 or(NullableInt52 fallback) { + if (value == null) { + return fallback; + } else { + return this; + } + } + + @Override + public Object $getNullable() { + return this.getNullable(); + } + + @Nullable + public Int52 getNullable() { + return value; + } + + @Override + @Nullable + public Int52 getNullable(Int52 defaultValue) { + return value == null ? defaultValue : value; + } + + @NotNull + @Override + public NullableInt52 clone() { + if (value != null) { + return NullableInt52.of(value); + } else { + return NullableInt52.empty(); + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + var that = (NullableInt52) o; + return Objects.equals(value, that.value); + } + + @Override + public int hashCode() { + return value == null ? 0 : value.hashCode(); + } + + @Override + public String toString() { + if (value == null) return "null"; + return "" + value; + } +} diff --git a/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/NullableInt52Serializer.java b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/NullableInt52Serializer.java new file mode 100644 index 0000000..dcb22eb --- /dev/null +++ b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/NullableInt52Serializer.java @@ -0,0 +1,37 @@ +package it.cavallium.data.generator.nativedata; + +import it.cavallium.data.generator.DataSerializer; +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import org.jetbrains.annotations.NotNull; + +public class NullableInt52Serializer implements DataSerializer { + + public static final NullableInt52Serializer INSTANCE = new NullableInt52Serializer(); + + @Override + public void serialize(DataOutput dataOutput, @NotNull NullableInt52 data) throws IOException { + // 0b10000000 = empty, 0b00000000 = with value + if (data.isEmpty()) { + dataOutput.writeByte(0b10000000); + } else { + dataOutput.write(Int52Serializer.toByteArray(data.get().getValue())); + } + } + + @NotNull + @Override + public NullableInt52 deserialize(DataInput dataInput) throws IOException { + // 0b10000000 = empty, 0b00000000 = with value + byte firstByteAndIsPresent = dataInput.readByte(); + if ((firstByteAndIsPresent & 0b10000000) != 0) { + return NullableInt52.empty(); + } else { + byte[] secondPart = new byte[7]; + secondPart[0] = (byte) (firstByteAndIsPresent & 0b00001111); + dataInput.readFully(secondPart, 1, secondPart.length - 1); + return NullableInt52.of(Int52.fromLong(Int52Serializer.fromByteArray(secondPart))); + } + } +} diff --git a/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/NullableString.java b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/NullableString.java new file mode 100644 index 0000000..58d2b09 --- /dev/null +++ b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/NullableString.java @@ -0,0 +1,170 @@ +package it.cavallium.data.generator.nativedata; + +import it.cavallium.data.generator.NativeNullable; +import it.cavallium.data.generator.TypedNullable; +import java.io.Serial; +import java.io.Serializable; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +public class NullableString implements Serializable, IGenericNullable, TypedNullable { + + @Serial + private static final long serialVersionUID = 1L; + private static final NullableString NULL = new NullableString(null); + + private final String value; + + public NullableString(String value) { + this.value = value; + } + + @SuppressWarnings("ConstantConditions") + public static NullableString of(@NotNull String value) { + if (value == null) { + throw new NullPointerException(); + } else { + return new NullableString(value); + } + } + + public static NullableString ofNullable(@Nullable String value) { + if (value == null) { + return NULL; + } else { + return new NullableString(value); + } + } + + public static NullableString ofNullableBlank(@Nullable String value) { + if (value == null || value.isBlank()) { + return NULL; + } + return new NullableString(value); + } + + public static NullableString empty() { + return NULL; + } + + @Override + public boolean isEmpty() { + return value == null; + } + + @Override + public boolean isPresent() { + return value != null; + } + + public boolean isContentful() { + return value != null && !value.isBlank(); + } + + public boolean isBlank() { + return value == null || value.isBlank(); + } + + @Override + @NotNull + public String get() { + if (value == null) { + throw new NullPointerException(); + } else { + return value; + } + } + + @Override + public @NotNull NullableString or(@NotNull NativeNullable fallback) { + if (value == null) { + if (fallback.getClass() == NullableString.class) { + return (NullableString) fallback; + } else { + return ofNullable(fallback.getNullable()); + } + } else { + return this; + } + } + + @NotNull + public NullableString or(NullableString fallback) { + if (value == null) { + return fallback; + } else { + return this; + } + } + + public @NotNull NullableString orIfBlank(@NotNull NativeNullable fallback) { + if (isBlank()) { + if (fallback.getClass() == NullableString.class) { + return (NullableString) fallback; + } else { + return ofNullable(fallback.getNullable()); + } + } else { + return this; + } + } + + @NotNull + public NullableString orIfBlank(NullableString fallback) { + if (isBlank()) { + return fallback; + } else { + return this; + } + } + + @Override + public String $getNullable() { + return this.getNullable(); + } + + @Nullable + public String getNullable() { + return value; + } + + @Override + @Nullable + public String getNullable(String defaultValue) { + return value == null ? defaultValue : value; + } + + @NotNull + @Override + public NullableString clone() { + if (value != null) { + return NullableString.of(value); + } else { + return NullableString.empty(); + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + var that = (NullableString) o; + return Objects.equals(value, that.value); + } + + @Override + public int hashCode() { + return value == null ? 0 : value.hashCode(); + } + + @Override + public String toString() { + if (value == null) return "null"; + return "" + value; + } +} diff --git a/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/NullableStringSerializer.java b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/NullableStringSerializer.java new file mode 100644 index 0000000..6bcc6cd --- /dev/null +++ b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/NullableStringSerializer.java @@ -0,0 +1,34 @@ +package it.cavallium.data.generator.nativedata; + +import it.cavallium.data.generator.DataSerializer; +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import org.jetbrains.annotations.NotNull; + +public class NullableStringSerializer implements DataSerializer { + + public static final NullableStringSerializer INSTANCE = new NullableStringSerializer(); + + @Override + public void serialize(DataOutput dataOutput, @NotNull NullableString data) throws IOException { + if (data.isEmpty()) { + dataOutput.writeBoolean(false); + } else { + dataOutput.writeBoolean(true); + String dataContent = data.get(); + dataOutput.writeUTF(dataContent); + } + } + + @NotNull + @Override + public NullableString deserialize(DataInput dataInput) throws IOException { + var isPresent = dataInput.readBoolean(); + if (!isPresent) { + return NullableString.empty(); + } else { + return NullableString.of(dataInput.readUTF()); + } + } +} diff --git a/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/Nullableboolean.java b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/Nullableboolean.java new file mode 100644 index 0000000..b40b838 --- /dev/null +++ b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/Nullableboolean.java @@ -0,0 +1,145 @@ +package it.cavallium.data.generator.nativedata; + +import it.cavallium.data.generator.NativeNullable; +import java.io.Serial; +import java.io.Serializable; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +public class Nullableboolean implements Serializable, IGenericNullable, NativeNullable { + + @Serial + private static final long serialVersionUID = 1L; + private static final Nullableboolean NULL = new Nullableboolean(null); + + private final Boolean value; + + public Nullableboolean(Boolean value) { + this.value = value; + } + + public static Nullableboolean of(boolean value) { + return new Nullableboolean(value); + } + + public static Nullableboolean ofNullable(@Nullable Boolean value) { + if (value == null) { + return NULL; + } else { + return new Nullableboolean(value); + } + } + + public static Nullableboolean empty() { + return NULL; + } + + public boolean isEmpty() { + return value == null; + } + + public boolean isPresent() { + return value != null; + } + + @Override + public @NotNull Boolean orElse(@NotNull Boolean defaultValue) { + if (value == null) { + return defaultValue; + } else { + return value; + } + } + + @Override + public @NotNull Nullableboolean or(@NotNull NativeNullable fallback) { + if (value == null) { + if (fallback.getClass() == Nullableboolean.class) { + return (Nullableboolean) fallback; + } else { + return ofNullable(fallback.getNullable()); + } + } else { + return this; + } + } + + @NotNull + public Nullableboolean or(Nullableboolean fallback) { + if (value == null) { + return fallback; + } else { + return this; + } + } + + public boolean get() { + if (value == null) { + throw new NullPointerException(); + } else { + return value; + } + } + + public boolean orElse(boolean defaultValue) { + if (value == null) { + return defaultValue; + } else { + return value; + } + } + + @Override + public Boolean $getNullable() { + return this.getNullable(); + } + + @Nullable + public Boolean getNullable() { + return value; + } + + @Override + public @Nullable Boolean getNullable(@Nullable Boolean defaultValue) { + return value != null ? value : defaultValue; + } + + public boolean getNullable(boolean defaultValue) { + return value == null ? defaultValue : value; + } + + @NotNull + @Override + public Nullableboolean clone() { + if (value != null) { + return Nullableboolean.of(value); + } else { + return Nullableboolean.empty(); + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Nullableboolean that = (Nullableboolean) o; + return Objects.equals(value, that.value); + } + + @Override + public int hashCode() { + return value == null ? 0 : value.hashCode(); + } + + @Override + public String toString() { + if (value == null) return "null"; + return "" + value; + } + +} diff --git a/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/NullablebooleanSerializer.java b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/NullablebooleanSerializer.java new file mode 100644 index 0000000..dad1d70 --- /dev/null +++ b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/NullablebooleanSerializer.java @@ -0,0 +1,34 @@ +package it.cavallium.data.generator.nativedata; + +import it.cavallium.data.generator.DataSerializer; +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import org.jetbrains.annotations.NotNull; + +public class NullablebooleanSerializer implements DataSerializer { + + public static final NullablebooleanSerializer INSTANCE = new NullablebooleanSerializer(); + + @Override + public void serialize(DataOutput dataOutput, @NotNull Nullableboolean data) throws IOException { + if (data.isEmpty()) { + dataOutput.writeBoolean(false); + } else { + dataOutput.writeBoolean(true); + boolean dataContent = data.get(); + dataOutput.writeBoolean(dataContent); + } + } + + @NotNull + @Override + public Nullableboolean deserialize(DataInput dataInput) throws IOException { + var isPresent = dataInput.readBoolean(); + if (!isPresent) { + return Nullableboolean.empty(); + } else { + return Nullableboolean.of(dataInput.readBoolean()); + } + } +} diff --git a/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/Nullablebyte.java b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/Nullablebyte.java new file mode 100644 index 0000000..cd4c071 --- /dev/null +++ b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/Nullablebyte.java @@ -0,0 +1,152 @@ +package it.cavallium.data.generator.nativedata; + +import it.cavallium.data.generator.NativeNullable; +import java.io.Serial; +import java.io.Serializable; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +public class Nullablebyte implements Serializable, IGenericNullable, NativeNullable { + + @Serial + private static final long serialVersionUID = 1L; + private static final Nullablebyte NULL = new Nullablebyte(null); + + private final Byte value; + + public Nullablebyte(Byte value) { + this.value = value; + } + + public static Nullablebyte of(byte value) { + return new Nullablebyte(value); + } + + public static Nullablebyte ofNullable(@Nullable Byte value) { + if (value == null) { + return NULL; + } else { + return new Nullablebyte(value); + } + } + + public static Nullablebyte ofNullableNumber(@Nullable Number value) { + if (value == null) { + return NULL; + } else { + return new Nullablebyte(value.byteValue()); + } + } + + public static Nullablebyte empty() { + return NULL; + } + + public boolean isEmpty() { + return value == null; + } + + public boolean isPresent() { + return value != null; + } + + @Override + public @NotNull Byte orElse(@NotNull Byte defaultValue) { + if (value == null) { + return defaultValue; + } else { + return value; + } + } + + @Override + public @NotNull Nullablebyte or(@NotNull NativeNullable fallback) { + if (value == null) { + if (fallback.getClass() == Nullablebyte.class) { + return (Nullablebyte) fallback; + } else { + return ofNullable(fallback.getNullable()); + } + } else { + return this; + } + } + + @NotNull + public Nullablebyte or(Nullablebyte fallback) { + if (value == null) { + return fallback; + } else { + return this; + } + } + + public byte get() { + if (value == null) { + throw new NullPointerException(); + } else { + return value; + } + } + + public byte orElse(byte defaultValue) { + if (value == null) { + return defaultValue; + } else { + return value; + } + } + + @Override + public Byte $getNullable() { + return this.getNullable(); + } + + @Nullable + public Byte getNullable() { + return value; + } + + @Override + public @Nullable Byte getNullable(@Nullable Byte defaultValue) { + return value != null ? value : defaultValue; + } + + public byte getNullable(byte defaultValue) { + return value == null ? defaultValue : value; + } + + @NotNull + @Override + public Nullablebyte clone() { + if (value != null) { + return Nullablebyte.of(value); + } else { + return Nullablebyte.empty(); + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Nullablebyte that = (Nullablebyte) o; + return Objects.equals(value, that.value); + } + + @Override + public int hashCode() { + return value == null ? 0 : value.hashCode(); + } + + @Override + public String toString() { + if (value == null) return "null"; + return "" + value; + } +} diff --git a/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/NullablebyteSerializer.java b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/NullablebyteSerializer.java new file mode 100644 index 0000000..027e5de --- /dev/null +++ b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/NullablebyteSerializer.java @@ -0,0 +1,34 @@ +package it.cavallium.data.generator.nativedata; + +import it.cavallium.data.generator.DataSerializer; +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import org.jetbrains.annotations.NotNull; + +public class NullablebyteSerializer implements DataSerializer { + + public static final NullablebyteSerializer INSTANCE = new NullablebyteSerializer(); + + @Override + public void serialize(DataOutput dataOutput, @NotNull Nullablebyte data) throws IOException { + if (data.isEmpty()) { + dataOutput.writeBoolean(false); + } else { + dataOutput.writeBoolean(true); + byte dataContent = data.get(); + dataOutput.writeByte(dataContent); + } + } + + @NotNull + @Override + public Nullablebyte deserialize(DataInput dataInput) throws IOException { + var isPresent = dataInput.readBoolean(); + if (!isPresent) { + return Nullablebyte.empty(); + } else { + return Nullablebyte.of(dataInput.readByte()); + } + } +} diff --git a/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/Nullablechar.java b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/Nullablechar.java new file mode 100644 index 0000000..61586e0 --- /dev/null +++ b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/Nullablechar.java @@ -0,0 +1,144 @@ +package it.cavallium.data.generator.nativedata; + +import it.cavallium.data.generator.NativeNullable; +import java.io.Serial; +import java.io.Serializable; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +public class Nullablechar implements Serializable, IGenericNullable, NativeNullable { + + @Serial + private static final long serialVersionUID = 1L; + private static final Nullablechar NULL = new Nullablechar(null); + + private final Character value; + + public Nullablechar(Character value) { + this.value = value; + } + + public static Nullablechar of(char value) { + return new Nullablechar(value); + } + + public static Nullablechar ofNullable(@Nullable Character value) { + if (value == null) { + return NULL; + } else { + return new Nullablechar(value); + } + } + + public static Nullablechar empty() { + return NULL; + } + + public boolean isEmpty() { + return value == null; + } + + public boolean isPresent() { + return value != null; + } + + @Override + public @NotNull Character orElse(@NotNull Character defaultValue) { + if (value == null) { + return defaultValue; + } else { + return value; + } + } + + @Override + public @NotNull Nullablechar or(@NotNull NativeNullable fallback) { + if (value == null) { + if (fallback.getClass() == Nullablechar.class) { + return (Nullablechar) fallback; + } else { + return ofNullable(fallback.getNullable()); + } + } else { + return this; + } + } + + @NotNull + public Nullablechar or(Nullablechar fallback) { + if (value == null) { + return fallback; + } else { + return this; + } + } + + public char get() { + if (value == null) { + throw new NullPointerException(); + } else { + return value; + } + } + + public char orElse(char defaultValue) { + if (value == null) { + return defaultValue; + } else { + return value; + } + } + + @Override + public Character $getNullable() { + return this.getNullable(); + } + + @Nullable + public Character getNullable() { + return value; + } + + @Override + public @Nullable Character getNullable(@Nullable Character defaultValue) { + return value != null ? value : defaultValue; + } + + public char getNullable(char defaultValue) { + return value == null ? defaultValue : value; + } + + @NotNull + @Override + public Nullablechar clone() { + if (value != null) { + return Nullablechar.of(value); + } else { + return Nullablechar.empty(); + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + var that = (Nullablechar) o; + return Objects.equals(value, that.value); + } + + @Override + public int hashCode() { + return value == null ? 0 : value.hashCode(); + } + + @Override + public String toString() { + if (value == null) return "null"; + return "" + value; + } +} diff --git a/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/NullablecharSerializer.java b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/NullablecharSerializer.java new file mode 100644 index 0000000..c9a4d8b --- /dev/null +++ b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/NullablecharSerializer.java @@ -0,0 +1,34 @@ +package it.cavallium.data.generator.nativedata; + +import it.cavallium.data.generator.DataSerializer; +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import org.jetbrains.annotations.NotNull; + +public class NullablecharSerializer implements DataSerializer { + + public static final NullablecharSerializer INSTANCE = new NullablecharSerializer(); + + @Override + public void serialize(DataOutput dataOutput, @NotNull Nullablechar data) throws IOException { + if (data.isEmpty()) { + dataOutput.writeBoolean(false); + } else { + dataOutput.writeBoolean(true); + char dataContent = data.get(); + dataOutput.writeChar(dataContent); + } + } + + @NotNull + @Override + public Nullablechar deserialize(DataInput dataInput) throws IOException { + var isPresent = dataInput.readBoolean(); + if (!isPresent) { + return Nullablechar.empty(); + } else { + return Nullablechar.of(dataInput.readChar()); + } + } +} diff --git a/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/Nullabledouble.java b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/Nullabledouble.java new file mode 100644 index 0000000..70516a1 --- /dev/null +++ b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/Nullabledouble.java @@ -0,0 +1,152 @@ +package it.cavallium.data.generator.nativedata; + +import it.cavallium.data.generator.NativeNullable; +import java.io.Serial; +import java.io.Serializable; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +public class Nullabledouble implements Serializable, IGenericNullable, NativeNullable { + + @Serial + private static final long serialVersionUID = 1L; + private static final Nullabledouble NULL = new Nullabledouble(null); + + private final Double value; + + public Nullabledouble(Double value) { + this.value = value; + } + + public static Nullabledouble of(double value) { + return new Nullabledouble(value); + } + + public static Nullabledouble ofNullable(@Nullable Double value) { + if (value == null) { + return NULL; + } else { + return new Nullabledouble(value); + } + } + + public static Nullabledouble ofNullableNumber(@Nullable Number value) { + if (value == null) { + return NULL; + } else { + return new Nullabledouble(value.doubleValue()); + } + } + + public static Nullabledouble empty() { + return NULL; + } + + public boolean isEmpty() { + return value == null; + } + + public boolean isPresent() { + return value != null; + } + + @Override + public @NotNull Double orElse(@NotNull Double defaultValue) { + if (value == null) { + return defaultValue; + } else { + return value; + } + } + + @Override + public @NotNull Nullabledouble or(@NotNull NativeNullable fallback) { + if (value == null) { + if (fallback.getClass() == Nullabledouble.class) { + return (Nullabledouble) fallback; + } else { + return ofNullable(fallback.getNullable()); + } + } else { + return this; + } + } + + @NotNull + public Nullabledouble or(Nullabledouble fallback) { + if (value == null) { + return fallback; + } else { + return this; + } + } + + public double get() { + if (value == null) { + throw new NullPointerException(); + } else { + return value; + } + } + + public double orElse(double defaultValue) { + if (value == null) { + return defaultValue; + } else { + return value; + } + } + + @Override + public Double $getNullable() { + return this.getNullable(); + } + + @Nullable + public Double getNullable() { + return value; + } + + @Override + public @Nullable Double getNullable(@Nullable Double defaultValue) { + return value == null ? defaultValue : value; + } + + public double getNullable(double defaultValue) { + return value == null ? defaultValue : value; + } + + @NotNull + @Override + public Nullabledouble clone() { + if (value != null) { + return Nullabledouble.of(value); + } else { + return Nullabledouble.empty(); + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + var that = (Nullabledouble) o; + return Objects.equals(value, that.value); + } + + @Override + public int hashCode() { + return value == null ? 0 : value.hashCode(); + } + + @Override + public String toString() { + if (value == null) return "null"; + return "" + value; + } +} diff --git a/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/NullabledoubleSerializer.java b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/NullabledoubleSerializer.java new file mode 100644 index 0000000..0904bb5 --- /dev/null +++ b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/NullabledoubleSerializer.java @@ -0,0 +1,34 @@ +package it.cavallium.data.generator.nativedata; + +import it.cavallium.data.generator.DataSerializer; +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import org.jetbrains.annotations.NotNull; + +public class NullabledoubleSerializer implements DataSerializer { + + public static final NullabledoubleSerializer INSTANCE = new NullabledoubleSerializer(); + + @Override + public void serialize(DataOutput dataOutput, @NotNull Nullabledouble data) throws IOException { + if (data.isEmpty()) { + dataOutput.writeBoolean(false); + } else { + dataOutput.writeBoolean(true); + double dataContent = data.get(); + dataOutput.writeDouble(dataContent); + } + } + + @NotNull + @Override + public Nullabledouble deserialize(DataInput dataInput) throws IOException { + var isPresent = dataInput.readBoolean(); + if (!isPresent) { + return Nullabledouble.empty(); + } else { + return Nullabledouble.of(dataInput.readDouble()); + } + } +} diff --git a/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/Nullablefloat.java b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/Nullablefloat.java new file mode 100644 index 0000000..764aa29 --- /dev/null +++ b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/Nullablefloat.java @@ -0,0 +1,152 @@ +package it.cavallium.data.generator.nativedata; + +import it.cavallium.data.generator.NativeNullable; +import java.io.Serial; +import java.io.Serializable; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +public class Nullablefloat implements Serializable, IGenericNullable, NativeNullable { + + @Serial + private static final long serialVersionUID = 1L; + private static final Nullablefloat NULL = new Nullablefloat(null); + + private final Float value; + + public Nullablefloat(Float value) { + this.value = value; + } + + public static Nullablefloat of(float value) { + return new Nullablefloat(value); + } + + public static Nullablefloat ofNullable(@Nullable Float value) { + if (value == null) { + return NULL; + } else { + return new Nullablefloat(value); + } + } + + public static Nullablefloat ofNullableNumber(@Nullable Number value) { + if (value == null) { + return NULL; + } else { + return new Nullablefloat(value.floatValue()); + } + } + + public static Nullablefloat empty() { + return NULL; + } + + public boolean isEmpty() { + return value == null; + } + + public boolean isPresent() { + return value != null; + } + + @Override + public @NotNull Float orElse(@NotNull Float defaultValue) { + if (value == null) { + return defaultValue; + } else { + return value; + } + } + + @Override + public @NotNull Nullablefloat or(@NotNull NativeNullable fallback) { + if (value == null) { + if (fallback.getClass() == Nullablefloat.class) { + return (Nullablefloat) fallback; + } else { + return ofNullable(fallback.getNullable()); + } + } else { + return this; + } + } + + @NotNull + public Nullablefloat or(Nullablefloat fallback) { + if (value == null) { + return fallback; + } else { + return this; + } + } + + public float get() { + if (value == null) { + throw new NullPointerException(); + } else { + return value; + } + } + + public float orElse(float defaultValue) { + if (value == null) { + return defaultValue; + } else { + return value; + } + } + + @Override + public Object $getNullable() { + return this.getNullable(); + } + + @Nullable + public Float getNullable() { + return value; + } + + @Override + public @Nullable Float getNullable(@Nullable Float defaultValue) { + return value == null ? defaultValue : value; + } + + public float getNullable(float defaultValue) { + return value == null ? defaultValue : value; + } + + @NotNull + @Override + public Nullablefloat clone() { + if (value != null) { + return Nullablefloat.of(value); + } else { + return Nullablefloat.empty(); + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + var that = (Nullablefloat) o; + return Objects.equals(value, that.value); + } + + @Override + public int hashCode() { + return value == null ? 0 : value.hashCode(); + } + + @Override + public String toString() { + if (value == null) return "null"; + return "" + value; + } +} diff --git a/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/NullablefloatSerializer.java b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/NullablefloatSerializer.java new file mode 100644 index 0000000..2d8b150 --- /dev/null +++ b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/NullablefloatSerializer.java @@ -0,0 +1,34 @@ +package it.cavallium.data.generator.nativedata; + +import it.cavallium.data.generator.DataSerializer; +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import org.jetbrains.annotations.NotNull; + +public class NullablefloatSerializer implements DataSerializer { + + public static final NullablefloatSerializer INSTANCE = new NullablefloatSerializer(); + + @Override + public void serialize(DataOutput dataOutput, @NotNull Nullablefloat data) throws IOException { + if (data.isEmpty()) { + dataOutput.writeBoolean(false); + } else { + dataOutput.writeBoolean(true); + float dataContent = data.get(); + dataOutput.writeFloat(dataContent); + } + } + + @NotNull + @Override + public Nullablefloat deserialize(DataInput dataInput) throws IOException { + var isPresent = dataInput.readBoolean(); + if (!isPresent) { + return Nullablefloat.empty(); + } else { + return Nullablefloat.of(dataInput.readFloat()); + } + } +} diff --git a/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/Nullableint.java b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/Nullableint.java new file mode 100644 index 0000000..72e4af2 --- /dev/null +++ b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/Nullableint.java @@ -0,0 +1,152 @@ +package it.cavallium.data.generator.nativedata; + +import it.cavallium.data.generator.NativeNullable; +import java.io.Serial; +import java.io.Serializable; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +public class Nullableint implements Serializable, IGenericNullable, NativeNullable { + + @Serial + private static final long serialVersionUID = 1L; + private static final Nullableint NULL = new Nullableint(null); + + private final Integer value; + + public Nullableint(Integer value) { + this.value = value; + } + + public static Nullableint of(int value) { + return new Nullableint(value); + } + + public static Nullableint ofNullable(@Nullable Integer value) { + if (value == null) { + return NULL; + } else { + return new Nullableint(value); + } + } + + public static Nullableint ofNullableNumber(@Nullable Number value) { + if (value == null) { + return NULL; + } else { + return new Nullableint(value.intValue()); + } + } + + public static Nullableint empty() { + return NULL; + } + + public boolean isEmpty() { + return value == null; + } + + public boolean isPresent() { + return value != null; + } + + @Override + public @NotNull Integer orElse(@NotNull Integer defaultValue) { + if (value == null) { + return defaultValue; + } else { + return value; + } + } + + @Override + public @NotNull Nullableint or(@NotNull NativeNullable fallback) { + if (value == null) { + if (fallback.getClass() == Nullableint.class) { + return (Nullableint) fallback; + } else { + return ofNullable(fallback.getNullable()); + } + } else { + return this; + } + } + + @NotNull + public Nullableint or(Nullableint fallback) { + if (value == null) { + return fallback; + } else { + return this; + } + } + + public int get() { + if (value == null) { + throw new NullPointerException(); + } else { + return value; + } + } + + public int orElse(int defaultValue) { + if (value == null) { + return defaultValue; + } else { + return value; + } + } + + @Override + public Integer $getNullable() { + return this.getNullable(); + } + + @Nullable + public Integer getNullable() { + return value; + } + + @Override + public @Nullable Integer getNullable(@Nullable Integer defaultValue) { + return value == null ? defaultValue : value; + } + + public int getNullable(int defaultValue) { + return value == null ? defaultValue : value; + } + + @NotNull + @Override + public Nullableint clone() { + if (value != null) { + return Nullableint.of(value); + } else { + return Nullableint.empty(); + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + var that = (Nullableint) o; + return Objects.equals(value, that.value); + } + + @Override + public int hashCode() { + return value == null ? 0 : value.hashCode(); + } + + @Override + public String toString() { + if (value == null) return "null"; + return "" + value; + } +} diff --git a/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/NullableintSerializer.java b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/NullableintSerializer.java new file mode 100644 index 0000000..f9836db --- /dev/null +++ b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/NullableintSerializer.java @@ -0,0 +1,34 @@ +package it.cavallium.data.generator.nativedata; + +import it.cavallium.data.generator.DataSerializer; +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import org.jetbrains.annotations.NotNull; + +public class NullableintSerializer implements DataSerializer { + + public static final NullableintSerializer INSTANCE = new NullableintSerializer(); + + @Override + public void serialize(DataOutput dataOutput, @NotNull Nullableint data) throws IOException { + if (data.isEmpty()) { + dataOutput.writeBoolean(false); + } else { + dataOutput.writeBoolean(true); + int dataContent = data.get(); + dataOutput.writeInt(dataContent); + } + } + + @NotNull + @Override + public Nullableint deserialize(DataInput dataInput) throws IOException { + var isPresent = dataInput.readBoolean(); + if (!isPresent) { + return Nullableint.empty(); + } else { + return Nullableint.of(dataInput.readInt()); + } + } +} diff --git a/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/Nullablelong.java b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/Nullablelong.java new file mode 100644 index 0000000..8335a17 --- /dev/null +++ b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/Nullablelong.java @@ -0,0 +1,152 @@ +package it.cavallium.data.generator.nativedata; + +import it.cavallium.data.generator.NativeNullable; +import java.io.Serial; +import java.io.Serializable; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +public class Nullablelong implements Serializable, IGenericNullable, NativeNullable { + + @Serial + private static final long serialVersionUID = 1L; + private static final Nullablelong NULL = new Nullablelong(null); + + private final Long value; + + public Nullablelong(Long value) { + this.value = value; + } + + public static Nullablelong of(long value) { + return new Nullablelong(value); + } + + public static Nullablelong ofNullable(@Nullable Long value) { + if (value == null) { + return NULL; + } else { + return new Nullablelong(value); + } + } + + public static Nullablelong ofNullableNumber(@Nullable Number value) { + if (value == null) { + return NULL; + } else { + return new Nullablelong(value.longValue()); + } + } + + public static Nullablelong empty() { + return NULL; + } + + public boolean isEmpty() { + return value == null; + } + + public boolean isPresent() { + return value != null; + } + + @Override + public @NotNull Long orElse(@NotNull Long defaultValue) { + if (value == null) { + return defaultValue; + } else { + return value; + } + } + + @Override + public @NotNull Nullablelong or(@NotNull NativeNullable fallback) { + if (value == null) { + if (fallback.getClass() == Nullablelong.class) { + return (Nullablelong) fallback; + } else { + return ofNullable(fallback.getNullable()); + } + } else { + return this; + } + } + + @NotNull + public Nullablelong or(Nullablelong fallback) { + if (value == null) { + return fallback; + } else { + return this; + } + } + + public long get() { + if (value == null) { + throw new NullPointerException(); + } else { + return value; + } + } + + public long orElse(long defaultValue) { + if (value == null) { + return defaultValue; + } else { + return value; + } + } + + @Override + public Long $getNullable() { + return this.getNullable(); + } + + @Nullable + public Long getNullable() { + return value; + } + + @Override + public @Nullable Long getNullable(@Nullable Long defaultValue) { + return value == null ? defaultValue : value; + } + + public long getNullable(long defaultValue) { + return value == null ? defaultValue : value; + } + + @NotNull + @Override + public Nullablelong clone() { + if (value != null) { + return Nullablelong.of(value); + } else { + return Nullablelong.empty(); + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + var that = (Nullablelong) o; + return Objects.equals(value, that.value); + } + + @Override + public int hashCode() { + return value == null ? 0 : value.hashCode(); + } + + @Override + public String toString() { + if (value == null) return "null"; + return "" + value; + } +} diff --git a/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/NullablelongSerializer.java b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/NullablelongSerializer.java new file mode 100644 index 0000000..3b380c5 --- /dev/null +++ b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/NullablelongSerializer.java @@ -0,0 +1,34 @@ +package it.cavallium.data.generator.nativedata; + +import it.cavallium.data.generator.DataSerializer; +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import org.jetbrains.annotations.NotNull; + +public class NullablelongSerializer implements DataSerializer { + + public static final NullablelongSerializer INSTANCE = new NullablelongSerializer(); + + @Override + public void serialize(DataOutput dataOutput, @NotNull Nullablelong data) throws IOException { + if (data.isEmpty()) { + dataOutput.writeBoolean(false); + } else { + dataOutput.writeBoolean(true); + long dataContent = data.get(); + dataOutput.writeLong(dataContent); + } + } + + @NotNull + @Override + public Nullablelong deserialize(DataInput dataInput) throws IOException { + var isPresent = dataInput.readBoolean(); + if (!isPresent) { + return Nullablelong.empty(); + } else { + return Nullablelong.of(dataInput.readLong()); + } + } +} diff --git a/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/Nullableshort.java b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/Nullableshort.java new file mode 100644 index 0000000..43ffd06 --- /dev/null +++ b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/Nullableshort.java @@ -0,0 +1,152 @@ +package it.cavallium.data.generator.nativedata; + +import it.cavallium.data.generator.NativeNullable; +import java.io.Serial; +import java.io.Serializable; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +public class Nullableshort implements Serializable, IGenericNullable, NativeNullable { + + @Serial + private static final long serialVersionUID = 1L; + private static final Nullableshort NULL = new Nullableshort(null); + + private final Short value; + + public Nullableshort(Short value) { + this.value = value; + } + + public static Nullableshort of(short value) { + return new Nullableshort(value); + } + + public static Nullableshort ofNullable(@Nullable Short value) { + if (value == null) { + return NULL; + } else { + return new Nullableshort(value); + } + } + + public static Nullableshort ofNullableNumber(@Nullable Number value) { + if (value == null) { + return NULL; + } else { + return new Nullableshort(value.shortValue()); + } + } + + public static Nullableshort empty() { + return NULL; + } + + public boolean isEmpty() { + return value == null; + } + + public boolean isPresent() { + return value != null; + } + + @Override + public @NotNull Short orElse(@NotNull Short defaultValue) { + if (value == null) { + return defaultValue; + } else { + return value; + } + } + + @Override + public @NotNull Nullableshort or(@NotNull NativeNullable fallback) { + if (value == null) { + if (fallback.getClass() == Nullableshort.class) { + return (Nullableshort) fallback; + } else { + return ofNullable(fallback.getNullable()); + } + } else { + return this; + } + } + + @NotNull + public Nullableshort or(Nullableshort fallback) { + if (value == null) { + return fallback; + } else { + return this; + } + } + + public short get() { + if (value == null) { + throw new NullPointerException(); + } else { + return value; + } + } + + public short orElse(short defaultValue) { + if (value == null) { + return defaultValue; + } else { + return value; + } + } + + @Override + public Short $getNullable() { + return this.getNullable(); + } + + @Nullable + public Short getNullable() { + return value; + } + + @Override + public @Nullable Short getNullable(@Nullable Short defaultValue) { + return value == null ? defaultValue : value; + } + + public short getNullable(short defaultValue) { + return value == null ? defaultValue : value; + } + + @NotNull + @Override + public Nullableshort clone() { + if (value != null) { + return Nullableshort.of(value); + } else { + return Nullableshort.empty(); + } + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + var that = (Nullableshort) o; + return Objects.equals(value, that.value); + } + + @Override + public int hashCode() { + return value == null ? 0 : value.hashCode(); + } + + @Override + public String toString() { + if (value == null) return "null"; + return "" + value; + } +} diff --git a/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/NullableshortSerializer.java b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/NullableshortSerializer.java new file mode 100644 index 0000000..b091a1a --- /dev/null +++ b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/NullableshortSerializer.java @@ -0,0 +1,34 @@ +package it.cavallium.data.generator.nativedata; + +import it.cavallium.data.generator.DataSerializer; +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import org.jetbrains.annotations.NotNull; + +public class NullableshortSerializer implements DataSerializer { + + public static final NullableshortSerializer INSTANCE = new NullableshortSerializer(); + + @Override + public void serialize(DataOutput dataOutput, @NotNull Nullableshort data) throws IOException { + if (data.isEmpty()) { + dataOutput.writeBoolean(false); + } else { + dataOutput.writeBoolean(true); + short dataContent = data.get(); + dataOutput.writeShort(dataContent); + } + } + + @NotNull + @Override + public Nullableshort deserialize(DataInput dataInput) throws IOException { + var isPresent = dataInput.readBoolean(); + if (!isPresent) { + return Nullableshort.empty(); + } else { + return Nullableshort.of(dataInput.readShort()); + } + } +} diff --git a/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/StringSerializer.java b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/StringSerializer.java new file mode 100644 index 0000000..0628a6d --- /dev/null +++ b/data-generator-runtime/src/main/java/it/cavallium/data/generator/nativedata/StringSerializer.java @@ -0,0 +1,63 @@ +package it.cavallium.data.generator.nativedata; + +import it.cavallium.data.generator.DataSerializer; +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import java.nio.ByteBuffer; +import java.nio.CharBuffer; +import java.nio.channels.Channels; +import java.nio.charset.CharacterCodingException; +import java.nio.charset.CharsetDecoder; +import java.nio.charset.CharsetEncoder; +import java.nio.charset.CodingErrorAction; +import java.nio.charset.MalformedInputException; +import java.nio.charset.StandardCharsets; +import java.nio.charset.UnmappableCharacterException; +import org.jetbrains.annotations.NotNull; + +public class StringSerializer implements DataSerializer { + + public static final StringSerializer INSTANCE = new StringSerializer(); + private static final ThreadLocal UTF8_ENCODER = ThreadLocal.withInitial(() -> StandardCharsets.UTF_8 + .newEncoder() + .onUnmappableCharacter(CodingErrorAction.REPORT) + .onMalformedInput(CodingErrorAction.REPORT) + ); + private static final ThreadLocal UTF8_DECODER = ThreadLocal.withInitial(() -> StandardCharsets.UTF_8 + .newDecoder() + .onUnmappableCharacter(CodingErrorAction.REPORT) + .onMalformedInput(CodingErrorAction.REPORT) + ); + + @Override + public void serialize(DataOutput dataOutput, @NotNull String data) throws IOException { + try { + var bytes = UTF8_ENCODER.get().reset().encode(CharBuffer.wrap(data)); + + dataOutput.writeInt(bytes.limit()); + if (bytes.hasArray()) { + dataOutput.write(bytes.array(), bytes.arrayOffset(), bytes.limit()); + } else { + while (bytes.hasRemaining()) { + dataOutput.writeByte(bytes.get()); + } + } + } catch (IllegalStateException | CharacterCodingException ex) { + throw new IOException("Can't encode this UTF-8 string", ex); + } + } + + @NotNull + @Override + public String deserialize(DataInput dataInput) throws IOException { + byte[] bytes = new byte[dataInput.readInt()]; + dataInput.readFully(bytes); + try { + CharBuffer decoded = UTF8_DECODER.get().reset().decode(ByteBuffer.wrap(bytes)); + return decoded.toString(); + } catch (IllegalStateException | CharacterCodingException ex) { + throw new IOException("Can't decode this UTF-8 string", ex); + } + } +} diff --git a/data-generator-runtime/src/main/java/module-info.java b/data-generator-runtime/src/main/java/module-info.java new file mode 100644 index 0000000..cc2d60f --- /dev/null +++ b/data-generator-runtime/src/main/java/module-info.java @@ -0,0 +1,6 @@ +module data.generator.runtime { + exports it.cavallium.data.generator.nativedata; + exports it.cavallium.data.generator; + requires org.jetbrains.annotations; + requires it.unimi.dsi.fastutil; +} \ No newline at end of file diff --git a/data-generator-runtime/src/test/java/it/cavallium/data/generator/nativedata/TestInt52Serializer.java b/data-generator-runtime/src/test/java/it/cavallium/data/generator/nativedata/TestInt52Serializer.java new file mode 100644 index 0000000..ca1a5a6 --- /dev/null +++ b/data-generator-runtime/src/test/java/it/cavallium/data/generator/nativedata/TestInt52Serializer.java @@ -0,0 +1,71 @@ +package it.cavallium.data.generator.nativedata; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; +import org.jetbrains.annotations.Nullable; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class TestInt52Serializer { + + @Test + public void testInt52Serialization() throws IOException { + for (int i = 0; i <= 300; i++) { + testInt52Serialization(i); + } + testInt52Serialization(0xF_FF_FF_FF_FF_FF_FFL); + testInt52Serialization(1099511627775L); + testInt52Serialization(999619292661L); + } + + public void testInt52Serialization(long n) throws IOException { + var serializer = new Int52Serializer(); + byte[] out; + try (var baos = new ByteArrayOutputStream()) { + try (var dos = new DataOutputStream(baos)) { + serializer.serialize(dos, Int52.fromLong(n)); + } + out = baos.toByteArray(); + } + + var bais = new ByteArrayInputStream(out); + var dis = new DataInputStream(bais); + Assertions.assertEquals(n, serializer.deserialize(dis).longValue(), "Deserialized number differ"); + } + + @Test + public void testInt52OptionalSerialization() throws IOException { + testInt52OptionalSerialization(null); + for (long i = 0; i <= 300; i++) { + testInt52OptionalSerialization(i); + } + testInt52OptionalSerialization(0xF_FF_FF_FF_FF_FF_FFL); + } + + public void testInt52OptionalSerialization(@Nullable Long n) throws IOException { + var serializer = new NullableInt52Serializer(); + byte[] out; + try (var baos = new ByteArrayOutputStream()) { + try (var dos = new DataOutputStream(baos)) { + if (n == null) { + serializer.serialize(dos, NullableInt52.empty()); + } else { + serializer.serialize(dos, NullableInt52.of(Int52.fromLong(n))); + } + } + out = baos.toByteArray(); + } + + var bais = new ByteArrayInputStream(out); + var dis = new DataInputStream(bais); + if (n == null) { + Assertions.assertNull(serializer.deserialize(dis).getNullable(), "Deserialized number is not empty"); + } else { + Assertions.assertEquals(n, serializer.deserialize(dis).get().longValue(), "Deserialized number differ"); + } + } + +} diff --git a/pom.xml b/pom.xml index 73004ec..9b464fc 100644 --- a/pom.xml +++ b/pom.xml @@ -1,82 +1,21 @@ - - + 4.0.0 - - Data generator - it.cavallium data-generator - 0.9.${revision} - maven-plugin + it.cavallium + ${revision} + pom - UTF-8 - 0-SNAPSHOT + 1.0.0.0-SNAPSHOT - - - mchv-release - MCHV Release Apache Maven Packages - https://mvn.mchv.eu/repository/mchv - - - mchv-snapshot - MCHV Snapshot Apache Maven Packages - https://mvn.mchv.eu/repository/mchv-snapshot - - - - - mchv-release-distribution - MCHV Release Apache Maven Packages Distribution - https://mvn.mchv.eu/repository/mchv - - - mchv-snapshot-distribution - MCHV Snapshot Apache Maven Packages Distribution - https://mvn.mchv.eu/repository/mchv-snapshot - - - - scm:git:https://git.ignuranza.net/andreacavalli/data-generator.git - scm:git:https://git.ignuranza.net/andreacavalli/data-generator.git - HEAD - + + data-generator-plugin + data-generator-runtime + - - org.apache.maven.plugins - maven-plugin-plugin - 3.6.1 - - - org.apache.maven.plugin-tools - maven-plugin-tools-annotations - 3.6.1 - - - - - maven-surefire-plugin - 3.0.0-M5 - - - org.junit.jupiter - junit-jupiter-engine - 5.9.0 - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.8.1 - - 17 - UTF-8 - - org.codehaus.mojo flatten-maven-plugin @@ -103,163 +42,5 @@ - - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - - org.apache.maven.plugins - - - maven-plugin-plugin - - - [3.6.1,) - - - descriptor - - - - - - - - - - org.codehaus.mojo - - - flatten-maven-plugin - - - [1.1.0,) - - - flatten - - - - - - - - - - - - - - - - commons-io - commons-io - 2.11.0 - - - org.yaml - snakeyaml - 1.33 - - - com.squareup - javapoet - 1.14.0-records - - - org.jetbrains - annotations - 23.0.0 - - - it.unimi.dsi - fastutil - 8.5.11 - - - org.apache.maven - maven-core - 3.8.5 - provided - - - org.apache.maven - maven-plugin-api - 3.8.5 - provided - - - org.apache.maven.plugin-tools - maven-plugin-annotations - 3.6.4 - provided - - - org.apache.maven - maven-project - 2.2.1 - - - junit - junit - - - - - io.soabase.record-builder - record-builder-core - 34 - - - org.slf4j - slf4j-api - 2.0.3 - - - org.apache.logging.log4j - log4j-core - 2.19.0 - - - org.apache.logging.log4j - log4j-slf4j2-impl - 2.19.0 - - - junit - junit - - - org.hamcrest - hamcrest-core - - - - - org.junit.jupiter - junit-jupiter-api - 5.9.0 - test - - - org.hamcrest - hamcrest-core - - - - - it.cavallium - data-generator-runtime - 1.0.77 - - - \ No newline at end of file +