diff --git a/src/main/java/org/gcube/informationsystem/types/TypeBinder.java b/src/main/java/org/gcube/informationsystem/types/TypeBinder.java index 0f5d8ec..d9e953d 100644 --- a/src/main/java/org/gcube/informationsystem/types/TypeBinder.java +++ b/src/main/java/org/gcube/informationsystem/types/TypeBinder.java @@ -122,28 +122,28 @@ public class TypeBinder { protected static Property getProperty(ISProperty propertyAnnotation, Method method){ String name = propertyAnnotation.name().isEmpty()?getPropertyNameFromMethodName(method):propertyAnnotation.name(); - Property prop = new Property(); - prop.name = name; - prop.description = propertyAnnotation.description(); - prop.mandatory= propertyAnnotation.mandatory(); - prop.notnull = !propertyAnnotation.nullable(); - prop.readonly = propertyAnnotation.readonly(); - if(propertyAnnotation.max()>0) prop.max = propertyAnnotation.max(); - if(propertyAnnotation.max()>=propertyAnnotation.min() && propertyAnnotation.min()>0) prop.min = propertyAnnotation.min(); - if(!propertyAnnotation.regexpr().isEmpty()) prop.regexpr = propertyAnnotation.regexpr(); + Property property = new Property(); + property.name = name; + property.description = propertyAnnotation.description(); + property.mandatory= propertyAnnotation.mandatory(); + property.notnull = !propertyAnnotation.nullable(); + property.readonly = propertyAnnotation.readonly(); + if(propertyAnnotation.max()>0) property.max = propertyAnnotation.max(); + if(propertyAnnotation.max()>=propertyAnnotation.min() && propertyAnnotation.min()>0) property.min = propertyAnnotation.min(); + if(!propertyAnnotation.regexpr().isEmpty()) property.regexpr = propertyAnnotation.regexpr(); logger.trace("Looking for property type type {}", method.getReturnType()); Class type = method.getReturnType(); if(Embedded.class.isAssignableFrom(type)){ - prop.linkedClass = getStaticStringFieldByName(type, NAME, type.getSimpleName()); - prop.type = OType.EMBEDDED.getIntValue(); + property.linkedClass = getStaticStringFieldByName(type, NAME, type.getSimpleName()); + property.type = OType.EMBEDDED.getIntValue(); }else if (Type.getTypeByClass(type)!=null) { - prop.type = Type.getTypeByClass(type).getIntValue(); + property.type = Type.getTypeByClass(type).getIntValue(); } else { throw new RuntimeException("Type " + type.getSimpleName() + " not reconized"); } - return prop; + return property; } @@ -209,12 +209,10 @@ public class TypeBinder { return properties; } - - } @JsonAutoDetect(fieldVisibility=JsonAutoDetect.Visibility.ANY) - public static class Property{ + public static class Property { private String name= ""; private String description= "";