← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14005: remove deep scanning of types, messed up the cache, and its not needed anymore because of the typ...

 

------------------------------------------------------------
revno: 14005
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-02-13 13:55:35 +0700
message:
  remove deep scanning of types, messed up the cache, and its not needed anymore because of the type controller
modified:
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ReflectionUtils.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ReflectionUtils.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ReflectionUtils.java	2014-02-13 05:51:55 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ReflectionUtils.java	2014-02-13 06:55:35 +0000
@@ -548,8 +548,6 @@
 
         private boolean identifiableObject;
 
-        private Map<String, PropertyDescriptor> objects;
-
         private PropertyDescriptor( Method method )
         {
             this.method = method;
@@ -652,40 +650,16 @@
         {
             this.identifiableObject = identifiableObject;
         }
-
-        @JsonProperty
-        public Map<String, PropertyDescriptor> getObjects()
-        {
-            return objects;
-        }
-
-        public void setObjects( Map<String, PropertyDescriptor> objects )
-        {
-            this.objects = objects;
-        }
     }
 
     public static Map<String, PropertyDescriptor> getJacksonClassMap( Class<?> clazz )
     {
-        return getJacksonClassMap( clazz, 2 );
-    }
-
-    public static Map<String, PropertyDescriptor> getJacksonClassMap( Class<?> clazz, int level )
-    {
         // this short-circuits the level stuff for now, need to fix this properly
         if ( classMapCache.containsKey( clazz ) )
         {
             return classMapCache.get( clazz );
         }
 
-        boolean deep = false;
-        level--;
-
-        if ( level > 0 )
-        {
-            deep = true;
-        }
-
         Map<String, PropertyDescriptor> output = Maps.newLinkedHashMap();
         List<Method> allMethods = getAllMethods( clazz );
 
@@ -726,7 +700,16 @@
                 if ( method.isAnnotationPresent( JacksonXmlProperty.class ) )
                 {
                     JacksonXmlProperty jacksonXmlProperty = method.getAnnotation( JacksonXmlProperty.class );
-                    descriptor.setXmlName( jacksonXmlProperty.localName() );
+
+                    if ( jacksonXmlProperty.localName().isEmpty() )
+                    {
+                        descriptor.setXmlName( name );
+                    }
+                    else
+                    {
+                        descriptor.setXmlName( jacksonXmlProperty.localName() );
+                    }
+
                     descriptor.setXmlAttribute( jacksonXmlProperty.isAttribute() );
                 }
 
@@ -745,12 +728,6 @@
                 if ( IdentifiableObject.class.isAssignableFrom( returnType ) )
                 {
                     descriptor.setIdentifiableObject( true );
-
-                    if ( deep )
-                    {
-                        Map<String, PropertyDescriptor> classMap = getJacksonClassMap( returnType, level );
-                        descriptor.setObjects( classMap );
-                    }
                 }
                 else if ( Collection.class.isAssignableFrom( returnType ) )
                 {
@@ -765,12 +742,6 @@
                         {
                             descriptor.setCollection( true );
                             descriptor.setIdentifiableObject( true );
-
-                            if ( deep )
-                            {
-                                Map<String, PropertyDescriptor> classMap = getJacksonClassMap( returnType, level );
-                                descriptor.setObjects( classMap );
-                            }
                         }
                     }
                 }