Changing the way to serialise a type of a property

This commit is contained in:
Luca Frosini 2021-01-19 11:21:53 +01:00
parent df1736f39b
commit 613fc76259
2 changed files with 13 additions and 10 deletions

View File

@ -205,14 +205,17 @@ public class PropertyTypeName {
}
try {
genericBaseType = null;
genericBaseType = BaseType.getBaseTypeFromString(generic);
if(genericBaseType.ordinal()>BaseType.PROPERTY.ordinal()) {
throw new IllegalArgumentException("The generic of a " + baseType.toString() + " cannot be a Set, a List or a Map.");
}
}catch (IllegalArgumentException e) {
genericClassName = generic;
}
if(genericBaseType!= null && genericBaseType.ordinal()>BaseType.PROPERTY.ordinal()) {
throw new IllegalArgumentException("The generic of a " + baseType.toString() + " cannot be a Set, a List or a Map.");
}
}
public String getType() {

View File

@ -87,7 +87,7 @@ public class TypeNameTest {
checkPropertyTypeName(value, expectedBaseType);
throw new Exception(value + " should not be a valid value");
}catch (IllegalArgumentException e) {
logger.debug("{} is not a valid value as expected", value);
logger.debug("{} is not a valid value as expected : {}", value, e.getMessage());
// This is what we want
}
}
@ -99,16 +99,16 @@ public class TypeNameTest {
stringBuffer.append(baseType.toString());
if(baseType.ordinal()>BaseType.PROPERTY.ordinal()) {
stringBuffer.append("<");
switch (baseType) {
case MAP:
// TODO
continue;
stringBuffer.append(BaseType.BYTE.toString());
stringBuffer.append(",");
stringBuffer.append(BaseType.STRING.toString());
stringBuffer.append(">");
break;
case SET: case LIST:
stringBuffer.append(BaseType.SET.toString());
stringBuffer.append("<");
// TODO
stringBuffer.append(">");
break;
@ -116,7 +116,7 @@ public class TypeNameTest {
break;
}
stringBuffer.append(">");
assertInvalidBasePropertyType(stringBuffer.toString(), baseType);