From f6e2b1300109e61ba7390a0c88e71cc762bdc434 Mon Sep 17 00:00:00 2001 From: Andreas Schilling Date: Fri, 13 Oct 2023 14:15:36 +0200 Subject: [PATCH] Migrate all validation related imports to Jakarta --- .../testclasses/AspectWithConstraints.java | 20 +++++++++---------- .../AspectWithGenericNumericProperty.java | 10 +++++----- ...geConstraintWithoutMinMaxIntegerValue.java | 13 ++++++------ .../AspectModelJsonSchemaGeneratorTest.java | 2 +- .../customconstraint/DoubleMinValidator.java | 1 + .../DurationMaxValidator.java | 1 + .../GregorianCalendarMinValidator.java | 1 + ...StructureElementJavaArtifactGenerator.java | 13 +++++------- .../AnnotationTypeMapping.java | 2 +- 9 files changed, 32 insertions(+), 31 deletions(-) diff --git a/core/esmf-aspect-model-document-generators/src/test/java/org/eclipse/esmf/aspectmodel/generator/json/testclasses/AspectWithConstraints.java b/core/esmf-aspect-model-document-generators/src/test/java/org/eclipse/esmf/aspectmodel/generator/json/testclasses/AspectWithConstraints.java index 94d17f10b..57bb64718 100644 --- a/core/esmf-aspect-model-document-generators/src/test/java/org/eclipse/esmf/aspectmodel/generator/json/testclasses/AspectWithConstraints.java +++ b/core/esmf-aspect-model-document-generators/src/test/java/org/eclipse/esmf/aspectmodel/generator/json/testclasses/AspectWithConstraints.java @@ -73,25 +73,25 @@ public class AspectWithConstraints { @JsonCreator public AspectWithConstraints( @JsonProperty( value = "testPropertyWithRegularExpression" ) - String testPropertyWithRegularExpression, + String testPropertyWithRegularExpression, @JsonProperty( value = "testPropertyWithDecimalMinDecimalMaxRangeConstraint" ) - BigDecimal testPropertyWithDecimalMinDecimalMaxRangeConstraint, + BigDecimal testPropertyWithDecimalMinDecimalMaxRangeConstraint, @JsonProperty( value = "testPropertyWithDecimalMaxRangeConstraint" ) - BigDecimal testPropertyWithDecimalMaxRangeConstraint, + BigDecimal testPropertyWithDecimalMaxRangeConstraint, @JsonProperty( value = "testPropertyWithMinMaxRangeConstraint" ) - Integer testPropertyWithMinMaxRangeConstraint, + Integer testPropertyWithMinMaxRangeConstraint, @JsonProperty( value = "testPropertyWithMinRangeConstraint" ) - Integer testPropertyWithMinRangeConstraint, + Integer testPropertyWithMinRangeConstraint, @JsonProperty( value = "testPropertyRangeConstraintWithFloatType" ) - Float testPropertyRangeConstraintWithFloatType, + Float testPropertyRangeConstraintWithFloatType, @JsonProperty( value = "testPropertyRangeConstraintWithDoubleType" ) - Double testPropertyRangeConstraintWithDoubleType, + Double testPropertyRangeConstraintWithDoubleType, @JsonProperty( value = "testPropertyWithMinMaxLengthConstraint" ) - String testPropertyWithMinMaxLengthConstraint, + String testPropertyWithMinMaxLengthConstraint, @JsonProperty( value = "testPropertyWithMinLengthConstraint" ) - BigInteger testPropertyWithMinLengthConstraint, + BigInteger testPropertyWithMinLengthConstraint, @JsonProperty( value = "testPropertyCollectionLengthConstraint" ) - List testPropertyCollectionLengthConstraint ) { + List testPropertyCollectionLengthConstraint ) { this.testPropertyWithRegularExpression = testPropertyWithRegularExpression; this.testPropertyWithDecimalMinDecimalMaxRangeConstraint = testPropertyWithDecimalMinDecimalMaxRangeConstraint; diff --git a/core/esmf-aspect-model-document-generators/src/test/java/org/eclipse/esmf/aspectmodel/generator/json/testclasses/AspectWithGenericNumericProperty.java b/core/esmf-aspect-model-document-generators/src/test/java/org/eclipse/esmf/aspectmodel/generator/json/testclasses/AspectWithGenericNumericProperty.java index 0621d8ea6..93c514e12 100644 --- a/core/esmf-aspect-model-document-generators/src/test/java/org/eclipse/esmf/aspectmodel/generator/json/testclasses/AspectWithGenericNumericProperty.java +++ b/core/esmf-aspect-model-document-generators/src/test/java/org/eclipse/esmf/aspectmodel/generator/json/testclasses/AspectWithGenericNumericProperty.java @@ -29,7 +29,7 @@ public class AspectWithGenericNumericProperty { @JsonCreator public AspectWithGenericNumericProperty( - @JsonProperty(value = "testNumber") Number testNumber) { + @JsonProperty( value = "testNumber" ) Number testNumber ) { this.testNumber = testNumber; } @@ -43,15 +43,15 @@ public Number getTestNumber() { } @Override - public boolean equals(final Object o) { - if (this == o) { + public boolean equals( final Object o ) { + if ( this == o ) { return true; } - if (o == null || getClass() != o.getClass()) { + if ( o == null || getClass() != o.getClass() ) { return false; } final AspectWithGenericNumericProperty that = (AspectWithGenericNumericProperty) o; - return Objects.equals(testNumber, that.testNumber); + return Objects.equals( testNumber, that.testNumber ); } } diff --git a/core/esmf-aspect-model-document-generators/src/test/java/org/eclipse/esmf/aspectmodel/generator/json/testclasses/AspectWithRangeConstraintWithoutMinMaxIntegerValue.java b/core/esmf-aspect-model-document-generators/src/test/java/org/eclipse/esmf/aspectmodel/generator/json/testclasses/AspectWithRangeConstraintWithoutMinMaxIntegerValue.java index 84a0f1270..f6c12fa11 100644 --- a/core/esmf-aspect-model-document-generators/src/test/java/org/eclipse/esmf/aspectmodel/generator/json/testclasses/AspectWithRangeConstraintWithoutMinMaxIntegerValue.java +++ b/core/esmf-aspect-model-document-generators/src/test/java/org/eclipse/esmf/aspectmodel/generator/json/testclasses/AspectWithRangeConstraintWithoutMinMaxIntegerValue.java @@ -23,11 +23,12 @@ /** Generated class for Test Aspect. */ public class AspectWithRangeConstraintWithoutMinMaxIntegerValue { - @NotNull private BigInteger testInt; + @NotNull + private BigInteger testInt; @JsonCreator public AspectWithRangeConstraintWithoutMinMaxIntegerValue( - @JsonProperty(value = "testInt") BigInteger testInt) { + @JsonProperty( value = "testInt" ) BigInteger testInt ) { this.testInt = testInt; } @@ -41,16 +42,16 @@ public BigInteger getTestInt() { } @Override - public boolean equals(final Object o) { - if (this == o) { + public boolean equals( final Object o ) { + if ( this == o ) { return true; } - if (o == null || getClass() != o.getClass()) { + if ( o == null || getClass() != o.getClass() ) { return false; } final AspectWithRangeConstraintWithoutMinMaxIntegerValue that = (AspectWithRangeConstraintWithoutMinMaxIntegerValue) o; - return Objects.equals(testInt, that.testInt); + return Objects.equals( testInt, that.testInt ); } } diff --git a/core/esmf-aspect-model-document-generators/src/test/java/org/eclipse/esmf/aspectmodel/generator/jsonschema/AspectModelJsonSchemaGeneratorTest.java b/core/esmf-aspect-model-document-generators/src/test/java/org/eclipse/esmf/aspectmodel/generator/jsonschema/AspectModelJsonSchemaGeneratorTest.java index 6b5bcc659..b3125a9db 100644 --- a/core/esmf-aspect-model-document-generators/src/test/java/org/eclipse/esmf/aspectmodel/generator/jsonschema/AspectModelJsonSchemaGeneratorTest.java +++ b/core/esmf-aspect-model-document-generators/src/test/java/org/eclipse/esmf/aspectmodel/generator/jsonschema/AspectModelJsonSchemaGeneratorTest.java @@ -840,7 +840,7 @@ public void testEnumComplexMapping( final KnownVersion metaModelVersion ) { assertThat( context. read( "$['components']['schemas']['ResultGood']['properties']['details']" + "['properties']['message']['enum'][0]" ) ).isEqualTo( "Evaluation succeeded." ); assertThat( context. read( "$['components']['schemas']['ResultGood']['properties']['details']" - + "['properties']['numericCode']['enum'][0]" ) ).isEqualTo( 10 ); + + "['properties']['numericCode']['enum'][0]" ) ).isEqualTo( 10 ); } @ParameterizedTest diff --git a/core/esmf-aspect-model-java-generator/src/main/java/org/eclipse/esmf/aspectmodel/java/customconstraint/DoubleMinValidator.java b/core/esmf-aspect-model-java-generator/src/main/java/org/eclipse/esmf/aspectmodel/java/customconstraint/DoubleMinValidator.java index 9ba9136de..750b7410b 100644 --- a/core/esmf-aspect-model-java-generator/src/main/java/org/eclipse/esmf/aspectmodel/java/customconstraint/DoubleMinValidator.java +++ b/core/esmf-aspect-model-java-generator/src/main/java/org/eclipse/esmf/aspectmodel/java/customconstraint/DoubleMinValidator.java @@ -12,6 +12,7 @@ */ package org.eclipse.esmf.aspectmodel.java.customconstraint; + import org.eclipse.esmf.metamodel.impl.BoundDefinition; import jakarta.validation.ConstraintValidator; diff --git a/core/esmf-aspect-model-java-generator/src/main/java/org/eclipse/esmf/aspectmodel/java/customconstraint/DurationMaxValidator.java b/core/esmf-aspect-model-java-generator/src/main/java/org/eclipse/esmf/aspectmodel/java/customconstraint/DurationMaxValidator.java index 830ecb97a..86d2f6630 100644 --- a/core/esmf-aspect-model-java-generator/src/main/java/org/eclipse/esmf/aspectmodel/java/customconstraint/DurationMaxValidator.java +++ b/core/esmf-aspect-model-java-generator/src/main/java/org/eclipse/esmf/aspectmodel/java/customconstraint/DurationMaxValidator.java @@ -12,6 +12,7 @@ */ package org.eclipse.esmf.aspectmodel.java.customconstraint; + import javax.xml.datatype.DatatypeConfigurationException; import javax.xml.datatype.DatatypeFactory; import javax.xml.datatype.Duration; diff --git a/core/esmf-aspect-model-java-generator/src/main/java/org/eclipse/esmf/aspectmodel/java/customconstraint/GregorianCalendarMinValidator.java b/core/esmf-aspect-model-java-generator/src/main/java/org/eclipse/esmf/aspectmodel/java/customconstraint/GregorianCalendarMinValidator.java index 92dcb8009..ac5e0a442 100644 --- a/core/esmf-aspect-model-java-generator/src/main/java/org/eclipse/esmf/aspectmodel/java/customconstraint/GregorianCalendarMinValidator.java +++ b/core/esmf-aspect-model-java-generator/src/main/java/org/eclipse/esmf/aspectmodel/java/customconstraint/GregorianCalendarMinValidator.java @@ -12,6 +12,7 @@ */ package org.eclipse.esmf.aspectmodel.java.customconstraint; + import javax.xml.datatype.DatatypeConfigurationException; import javax.xml.datatype.DatatypeFactory; import javax.xml.datatype.XMLGregorianCalendar; diff --git a/core/esmf-aspect-model-java-generator/src/main/java/org/eclipse/esmf/aspectmodel/java/pojo/StructureElementJavaArtifactGenerator.java b/core/esmf-aspect-model-java-generator/src/main/java/org/eclipse/esmf/aspectmodel/java/pojo/StructureElementJavaArtifactGenerator.java index 557ae1f32..5899ab6d4 100644 --- a/core/esmf-aspect-model-java-generator/src/main/java/org/eclipse/esmf/aspectmodel/java/pojo/StructureElementJavaArtifactGenerator.java +++ b/core/esmf-aspect-model-java-generator/src/main/java/org/eclipse/esmf/aspectmodel/java/pojo/StructureElementJavaArtifactGenerator.java @@ -26,10 +26,6 @@ import javax.xml.datatype.DatatypeConstants; import javax.xml.datatype.DatatypeFactory; -import org.apache.commons.lang3.StringUtils; -import org.apache.jena.rdf.model.ResourceFactory; -import org.apache.jena.vocabulary.XSD; -import org.apache.velocity.app.FieldMethodizer; import org.eclipse.esmf.aspectmodel.generator.ArtifactGenerator; import org.eclipse.esmf.aspectmodel.generator.TemplateEngine; import org.eclipse.esmf.aspectmodel.java.AspectModelJavaUtil; @@ -40,7 +36,6 @@ import org.eclipse.esmf.aspectmodel.java.ValueInitializer; import org.eclipse.esmf.aspectmodel.java.exception.CodeGenerationException; import org.eclipse.esmf.aspectmodel.resolver.services.DataType; - import org.eclipse.esmf.characteristic.Trait; import org.eclipse.esmf.metamodel.ComplexType; import org.eclipse.esmf.metamodel.Constraint; @@ -48,17 +43,19 @@ import org.eclipse.esmf.metamodel.StructureElement; import org.eclipse.esmf.metamodel.impl.DefaultScalar; import org.eclipse.esmf.metamodel.impl.DefaultScalarValue; - import org.eclipse.esmf.samm.KnownVersion; -import org.jboss.forge.roaster.Roaster; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.google.common.collect.ImmutableMap; - import jakarta.validation.constraints.NotNull; +import org.apache.commons.lang3.StringUtils; +import org.apache.jena.rdf.model.ResourceFactory; +import org.apache.jena.vocabulary.XSD; +import org.apache.velocity.app.FieldMethodizer; +import org.jboss.forge.roaster.Roaster; /** * A {@link ArtifactGenerator} that generates Java Pojo code diff --git a/core/esmf-aspect-model-java-generator/src/main/java/org/eclipse/esmf/aspectmodel/java/rangeconstraint/AnnotationTypeMapping.java b/core/esmf-aspect-model-java-generator/src/main/java/org/eclipse/esmf/aspectmodel/java/rangeconstraint/AnnotationTypeMapping.java index 10811f4a2..13731da62 100644 --- a/core/esmf-aspect-model-java-generator/src/main/java/org/eclipse/esmf/aspectmodel/java/rangeconstraint/AnnotationTypeMapping.java +++ b/core/esmf-aspect-model-java-generator/src/main/java/org/eclipse/esmf/aspectmodel/java/rangeconstraint/AnnotationTypeMapping.java @@ -83,4 +83,4 @@ ImmutableMap., Class> builder() public Class getAnnotationType( final Class type ) { return typeMapping.get( type ); } -} \ No newline at end of file +}