Skip to content

Commit a2dcff9

Browse files
committed
Add !v.isEmpty() for value String
1 parent 1d28fbf commit a2dcff9

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

core/esmf-aspect-model-java-generator/src/main/java/org/eclipse/esmf/aspectmodel/java/AspectModelJavaUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ public static String optionalExpression(
698698
final String modifiedExpression = expression.replace( target, "v" );
699699

700700
return "Optional.ofNullable(matcher.group(" + groupNum + "))"
701-
+ ".filter(v -> v != null)"
701+
+ ".filter(v -> !v.isEmpty())"
702702
+ ".map(v -> Integer.valueOf(v))"
703703
+ ".map(v -> "
704704
+ modifiedExpression

core/esmf-aspect-model-java-generator/src/test/java/org/eclipse/esmf/aspectmodel/java/AspectModelJavaGeneratorTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ void testGenerateAspectWithOptionalPropertyAndEntityWithSeparateFiles() throws I
259259
.orElseThrow( () -> new AssertionError( "Constructor not found in ProductionPeriodEntity" ) );
260260
String constructorBody = constructor.getBody().toString();
261261
assertThat( constructorBody ).contains( "Optional.ofNullable(" );
262-
assertThat( constructorBody ).contains( ".filter(v -> v != null)" );
262+
assertThat( constructorBody ).contains( ".filter(v -> !v.isEmpty())" );
263263
assertThat( constructorBody ).contains( "_datatypeFactory.newXMLGregorianCalendarDate(" );
264264
}
265265

0 commit comments

Comments
 (0)