Fixing code

This commit is contained in:
Luca Frosini 2024-06-04 16:56:32 +02:00
parent 49e000bfa2
commit 0c37a01339
1 changed files with 7 additions and 3 deletions

View File

@ -83,9 +83,11 @@ public final class PropertyDefinitionImpl extends PropertyBasicInfoImpl implemen
}
public static Object evaluateDefaultValue(BaseType baseType, String defaultValueAsString) {
if(defaultValueAsString.compareTo("null")==0) {
if(defaultValueAsString==null || defaultValueAsString.compareTo("null")==0) {
return null;
}
if(defaultValueAsString!=null) {
switch (baseType) {
case BOOLEAN:
@ -135,11 +137,12 @@ public final class PropertyDefinitionImpl extends PropertyBasicInfoImpl implemen
return null;
default:
return null;
break;
}
}
return null;
}
public PropertyDefinitionImpl(ISProperty propertyAnnotation, Method method) {
@ -158,7 +161,8 @@ public final class PropertyDefinitionImpl extends PropertyBasicInfoImpl implemen
this.propertyTypeName = new PropertyTypeName(method);
this.defaultValue = propertyAnnotation.defaultValue();
evaluateDefaultValue(propertyTypeName.getBaseType(), defaultValue);
// The default value is evaluated to test if compliant with the declared type
PropertyDefinitionImpl.evaluateDefaultValue(propertyTypeName.getBaseType(), defaultValue);
Class<?> clz = method.getReturnType();
logger.trace("Return Type for method {} is {}", method, clz);