From 03e671643ef9d630f5b42bbabd968ac0af7d91b0 Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Mon, 4 Jul 2016 13:29:44 +0000 Subject: [PATCH] Fixing TypeBinder for resource serialization git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/private/luca.frosini/information-system-model@129865 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../informationsystem/types/TypeBinder.java | 30 +++++++++---------- 1 file changed, 14 insertions(+), 16 deletions(-) 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= "";