Skip to content

Commit

Permalink
Fixed exception when loading model files with nullable properties set
Browse files Browse the repository at this point in the history
  • Loading branch information
hylkevds committed Apr 18, 2024
1 parent a50049e commit 48825bc
Showing 1 changed file with 31 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,17 @@ public class DefEntityProperty implements AnnotatedConfigurable<Void, Void> {
private boolean nullable;

/**
* Flag indicating this property must always be serialised, even if it is null.
* Flag indicating this property must always be serialised, even if it is
* null.
*/
@ConfigurableField(editor = EditorBoolean.class, optional = true,
label = "Serialise NULL", description = "Flag indicating this property must always be serialised, even if it is null.")
@EditorBoolean.EdOptsBool()
private boolean serialiseNull;

/**
* Flag indicating this property is a complex property with sub-properties that can be queried.
* Flag indicating this property is a complex property with sub-properties
* that can be queried.
*/
@ConfigurableField(editor = EditorBoolean.class, optional = true,
label = "HasCustomProps", description = "Flag indicating this property is a complex property with sub-properties that can be queried.")
Expand Down Expand Up @@ -146,7 +148,7 @@ public void init() {
public void registerProperties(ModelRegistry modelRegistry) {
if (entityProperty == null) {
PropertyType propType = modelRegistry.getPropertyType(type);
entityProperty = new EntityPropertyMain<>(name, propType, required, nullable, hasCustomProperties, serialiseNull)
entityProperty = new EntityPropertyMain<>(name, propType, required, isNullable(), hasCustomProperties, serialiseNull)
.setAliases(aliases.toArray(String[]::new))
.addAnnotations(annotations);
}
Expand Down Expand Up @@ -295,7 +297,8 @@ public DefEntityProperty addHandler(PropertyPersistenceMapper handler) {
}

/**
* Flag indicating this property must always be serialised, even if it is null.
* Flag indicating this property must always be serialised, even if it is
* null.
*
* @return the serialiseNull
*/
Expand All @@ -304,7 +307,8 @@ public boolean getSerialiseNull() {
}

/**
* Flag indicating this property must always be serialised, even if it is null.
* Flag indicating this property must always be serialised, even if it is
* null.
*
* @param serialiseNull the serialiseNull to set
* @return this.
Expand All @@ -315,7 +319,8 @@ public DefEntityProperty setSerialiseNull(boolean serialiseNull) {
}

/**
* Flag indicating this property is a complex property with sub-properties that can be queried.
* Flag indicating this property is a complex property with sub-properties
* that can be queried.
*
* @return the hasCustomProperties
*/
Expand All @@ -324,7 +329,8 @@ public boolean getHasCustomProperties() {
}

/**
* Flag indicating this property is a complex property with sub-properties that can be queried.
* Flag indicating this property is a complex property with sub-properties
* that can be queried.
*
* @param hasCustomProperties the hasCustomProperties to set
* @return this.
Expand Down Expand Up @@ -357,4 +363,22 @@ public DefEntityProperty addAnnotations(List<Annotation> annotationsToAdd) {
return this;
}

/**
* Flag indicating the property may be set to null.
*
* @return the nullable
*/
public boolean isNullable() {
return nullable;
}

/**
* Flag indicating the property may be set to null.
*
* @param nullable the nullable to set
*/
public void setNullable(boolean nullable) {
this.nullable = nullable;
}

}

0 comments on commit 48825bc

Please sign in to comment.