Update data generator
This commit is contained in:
parent
fed9d27a37
commit
e8c5304f61
2
pom.xml
2
pom.xml
|
@ -169,7 +169,7 @@
|
|||
<dependency>
|
||||
<groupId>it.cavallium</groupId>
|
||||
<artifactId>data-generator-runtime</artifactId>
|
||||
<version>1.0.62</version>
|
||||
<version>1.0.63</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<dependencyManagement>
|
||||
|
|
|
@ -66,6 +66,7 @@ import org.yaml.snakeyaml.Yaml;
|
|||
public class SourcesGenerator {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(SourcesGenerator.class);
|
||||
private static final boolean OVERRIDE_ALL_NULLABLE_METHODS = false;
|
||||
|
||||
private final SourcesGeneratorConfiguration configuration;
|
||||
|
||||
|
@ -913,6 +914,7 @@ public class SourcesGenerator {
|
|||
emptyMethod.returns(nullableClassType);
|
||||
emptyMethod.addStatement("return NULL");
|
||||
nullableTypeClass.addMethod(emptyMethod.build());
|
||||
if (OVERRIDE_ALL_NULLABLE_METHODS) {
|
||||
var isEmptyMethod = MethodSpec.methodBuilder("isEmpty");
|
||||
isEmptyMethod.addModifiers(Modifier.PUBLIC);
|
||||
isEmptyMethod.addModifiers(Modifier.FINAL);
|
||||
|
@ -978,6 +980,7 @@ public class SourcesGenerator {
|
|||
orMethodGeneric.addStatement("return this");
|
||||
orMethodGeneric.endControlFlow();
|
||||
nullableTypeClass.addMethod(orMethodGeneric.build());
|
||||
}
|
||||
var orMethodSpecific = MethodSpec.methodBuilder("or");
|
||||
orMethodSpecific.addParameter(ParameterSpec
|
||||
.builder(nullableTypeType, "fallback")
|
||||
|
@ -1001,6 +1004,7 @@ public class SourcesGenerator {
|
|||
getNullableMethod.returns(typeType);
|
||||
getNullableMethod.addStatement("return value");
|
||||
nullableTypeClass.addMethod(getNullableMethod.build());
|
||||
if (OVERRIDE_ALL_NULLABLE_METHODS) {
|
||||
var getNullableParam = MethodSpec.methodBuilder("getNullable");
|
||||
getNullableParam.addParameter(ParameterSpec
|
||||
.builder(typeType, "defaultValue")
|
||||
|
@ -1017,6 +1021,7 @@ public class SourcesGenerator {
|
|||
getNullableParam.addStatement("return value");
|
||||
getNullableParam.endControlFlow();
|
||||
nullableTypeClass.addMethod(getNullableParam.build());
|
||||
}
|
||||
var getDollarNullableMethod = MethodSpec.methodBuilder("$getNullable");
|
||||
getDollarNullableMethod.addModifiers(Modifier.PUBLIC);
|
||||
getDollarNullableMethod.addModifiers(Modifier.FINAL);
|
||||
|
|
Loading…
Reference in New Issue