/** * This method handles walking lists of lists. * * @param item item * @param path path * @return value at this path */ public static Object getPropByPath( Object item, String... path ) { Object o = item; for ( int index = 0; index < path.length; index++ ) { String propName = path[ index ]; if ( o == null ) { return null; } else if ( o.getClass().isArray() || o instanceof Collection ) { o = getCollectionProp(o, propName, index, path); break; } else { o = getProp( o, propName ); } } return Conversions.unifyListOrArray(o); }
/** * This method handles walking lists of lists. * * @param item item * @param path path * @return value at this path */ public static Object getPropByPath( Object item, String... path ) { Object o = item; for ( int index = 0; index < path.length; index++ ) { String propName = path[ index ]; if ( o == null ) { return null; } else if ( o.getClass().isArray() || o instanceof Collection ) { o = getCollectionProp(o, propName, index, path); break; } else { o = getProp( o, propName ); } } return Conversions.unifyListOrArray(o); }