@SuppressWarnings({ "unchecked", "rawtypes" })
   public static Object getNestedProperty(Object bean, String name)
       throws IllegalAccessException, InvocationTargetException, NoSuchMethodException, Exception
   {
       if(bean == null)
           return null;
       
  
       if(name == null || name.length() == 0)
					throw new IllegalArgumentException("name required");
       
       if(Collection.class.isAssignableFrom(bean.getClass()))
       {
        	   return getCollectionProperties((Collection<?>)bean,name);
       }
       
       int indexOfINDEXED_DELIM = -1;
       int indexOfMAPPED_DELIM = -1;
       int indexOfMAPPED_DELIM2 = -1;
       int indexOfNESTED_DELIM = -1;
       do
       {
           
           indexOfNESTED_DELIM = name.indexOf('.');
           indexOfMAPPED_DELIM = name.indexOf('(');
           indexOfMAPPED_DELIM2 = name.indexOf(')');
           if(indexOfMAPPED_DELIM2 >= 0 && indexOfMAPPED_DELIM >= 0 && (indexOfNESTED_DELIM < 0 || indexOfNESTED_DELIM > indexOfMAPPED_DELIM))
               indexOfNESTED_DELIM = name.indexOf('.', indexOfMAPPED_DELIM2);
           else
               indexOfNESTED_DELIM = name.indexOf('.');
           if(indexOfNESTED_DELIM < 0)
               break;
           String next = name.substring(0, indexOfNESTED_DELIM);
           indexOfINDEXED_DELIM = next.indexOf('[');
           indexOfMAPPED_DELIM = next.indexOf('(');
           if(bean instanceof Map)
               bean = ((Map<Object,Object>)bean).get(next);
           else
           if(indexOfMAPPED_DELIM >= 0)
               bean = getMappedProperty(bean, next);
           else
           if(indexOfINDEXED_DELIM >= 0)
               bean = getIndexedProperty(bean, next);
           else
               bean = getSimpleProperty(bean, next);
           
           if(bean == null)
        	   return null;
           
           name = name.substring(indexOfNESTED_DELIM + 1);
           
           if(Collection.class.isAssignableFrom(bean.getClass()))
           {
            	   return getCollectionProperties((Collection<?>)bean,name);
           }

       } while(true);
       indexOfINDEXED_DELIM = name.indexOf('[');
       indexOfMAPPED_DELIM = name.indexOf('(');
       if(bean instanceof Map)
           bean = ((Map)bean).get(name);
       else
       if(indexOfMAPPED_DELIM >= 0)
           bean = getMappedProperty(bean, name);
       else
       if(indexOfINDEXED_DELIM >= 0)
           bean = getIndexedProperty(bean, name);
       else
           bean = getSimpleProperty(bean, name);
       
       return bean;
   }
@ SuppressWarnings ( { "unchecked" , "rawtypes" } ) public static Object getNestedProperty ( Object bean , String name ) throws IllegalAccessException , InvocationTargetException , NoSuchMethodException , Exception { if ( bean == null ) return null ; if ( name == null || name . length ( ) == 0 ) throw new IllegalArgumentException ( "name required" ) ; if ( Collection . class . isAssignableFrom ( bean . getClass ( ) ) ) { return getCollectionProperties ( ( Collection < ? > ) bean , name ) ; } int indexOfINDEXED_DELIM = - 1 ; int indexOfMAPPED_DELIM = - 1 ; int indexOfMAPPED_DELIM2 = - 1 ; int indexOfNESTED_DELIM = - 1 ; do { indexOfNESTED_DELIM = name . indexOf ( '.' ) ; indexOfMAPPED_DELIM = name . indexOf ( '(' ) ; indexOfMAPPED_DELIM2 = name . indexOf ( ')' ) ; if ( indexOfMAPPED_DELIM2 >= 0 && indexOfMAPPED_DELIM >= 0 && ( indexOfNESTED_DELIM < 0 || indexOfNESTED_DELIM > indexOfMAPPED_DELIM ) ) indexOfNESTED_DELIM = name . indexOf ( '.' , indexOfMAPPED_DELIM2 ) ; else indexOfNESTED_DELIM = name . indexOf ( '.' ) ; if ( indexOfNESTED_DELIM < 0 ) break ; String next = name . substring ( 0 , indexOfNESTED_DELIM ) ; indexOfINDEXED_DELIM = next . indexOf ( '[' ) ; indexOfMAPPED_DELIM = next . indexOf ( '(' ) ; if ( bean instanceof Map ) bean = ( ( Map < Object , Object > ) bean ) . get ( next ) ; else if ( indexOfMAPPED_DELIM >= 0 ) bean = getMappedProperty ( bean , next ) ; else if ( indexOfINDEXED_DELIM >= 0 ) bean = getIndexedProperty ( bean , next ) ; else bean = getSimpleProperty ( bean , next ) ; if ( bean == null ) return null ; name = name . substring ( indexOfNESTED_DELIM + 1 ) ; if ( Collection . class . isAssignableFrom ( bean . getClass ( ) ) ) { return getCollectionProperties ( ( Collection < ? > ) bean , name ) ; } } while ( true ) ; indexOfINDEXED_DELIM = name . indexOf ( '[' ) ; indexOfMAPPED_DELIM = name . indexOf ( '(' ) ; if ( bean instanceof Map ) bean = ( ( Map ) bean ) . get ( name ) ; else if ( indexOfMAPPED_DELIM >= 0 ) bean = getMappedProperty ( bean , name ) ; else if ( indexOfINDEXED_DELIM >= 0 ) bean = getIndexedProperty ( bean , name ) ; else bean = getSimpleProperty ( bean , name ) ; return bean ; }
@param bean the bean to get the property
@param name the name
@return the nested object
@throws IllegalAccessException the illegal access exception
@throws InvocationTargetException the invocation
@throws NoSuchMethodException no such method
@throws Exception when an unknown error occurs