private Object processNestedObject ( Class targetClass , Method method , Class parameterType , String keyPrefix , Map < Class , Class > processedClassRelations , int arrayIndex , boolean watchAllFields ) throws Exception { Object nestedTarget = parameterType . getConstructor ( ) . newInstance ( ) ; Class nestedTargetClass = nestedTarget . getClass ( ) ; // check for cycles if ( processedClassRelations . containsKey ( nestedTargetClass ) && processedClassRelations . get ( nestedTargetClass ) . equals ( targetClass ) ) { log . warning ( "There is a cycle in the configuration class tree. ConfigBundle class may not " + "be populated as expected." ) ; } else { String key = getKeyName ( targetClass , method . getName ( ) , keyPrefix ) ; if ( arrayIndex >= 0 ) { key += "[" + arrayIndex + "]" ; } boolean isEmpty = processConfigBundleBeanSetters ( nestedTarget , nestedTargetClass , key , processedClassRelations , watchAllFields ) ; if ( isEmpty ) { return null ; } } return nestedTarget ; }
Create a new instance for nested class check for cycles and populate nested instance .