public void load(T item, Map vals) {
        for( Object k : vals.keySet() ) {
            Class cls = item.getClass();
            String key = (String)k;
            Object val = vals.get(key);
            Field f = null;
            int mod;
            
            while( f == null ) {
                try {
                    f = cls.getDeclaredField(key);
                }
                catch( NoSuchFieldException e ) {
                    // ignore
                }
                if( f == null ) {
                    cls = cls.getSuperclass();
                    if( cls == null || cls.getName().equals(Object.class.getName()) ) {
                        break;
                    }
                }
            }
            if( f == null ) {
                continue;
            }
            mod = f.getModifiers();
            if( Modifier.isTransient(mod) || Modifier.isStatic(mod) ) {
                continue;
            }
            try {
                f.setAccessible(true);
                f.set(item, val);
            }
            catch( IllegalAccessException e ) {
                String msg = "Error setting value for " + key + ":\n";
                
                if( val == null ) {
                    msg = msg + " (null)";
                }
                else {
                    msg = msg + " (" + val + ":" +
                        val.getClass().getName() + ")";
                }
                msg = msg + ":\n" + e.getClass().getName() + ":\n";
                throw new CacheManagementException(msg + e.getMessage());
            }
            catch( IllegalArgumentException e ) {
                String msg = "Error setting value for " + key;

                if( val == null ) {
                    msg = msg + " (null)";
                }
                else {
                    msg = msg + " (" + val + ":" +
                        val.getClass().getName() + ")";
                }
                msg = msg + ":\n" + e.getClass().getName() + ":\n";
                throw new CacheManagementException(msg + e.getMessage());
            }
        }
    }
public void load ( T item , Map vals ) { for ( Object k : vals . keySet ( ) ) { Class cls = item . getClass ( ) ; String key = ( String ) k ; Object val = vals . get ( key ) ; Field f = null ; int mod ; while ( f == null ) { try { f = cls . getDeclaredField ( key ) ; } catch ( NoSuchFieldException e ) { } if ( f == null ) { cls = cls . getSuperclass ( ) ; if ( cls == null || cls . getName ( ) . equals ( Object . class . getName ( ) ) ) { break ; } } } if ( f == null ) { continue ; } mod = f . getModifiers ( ) ; if ( Modifier . isTransient ( mod ) || Modifier . isStatic ( mod ) ) { continue ; } try { f . setAccessible ( true ) ; f . set ( item , val ) ; } catch ( IllegalAccessException e ) { String msg = "Error setting value for " + key + ":\n" ; if ( val == null ) { msg = msg + " (null)" ; } else { msg = msg + " (" + val + ":" + val . getClass ( ) . getName ( ) + ")" ; } msg = msg + ":\n" + e . getClass ( ) . getName ( ) + ":\n" ; throw new CacheManagementException ( msg + e . getMessage ( ) ) ; } catch ( IllegalArgumentException e ) { String msg = "Error setting value for " + key ; if ( val == null ) { msg = msg + " (null)" ; } else { msg = msg + " (" + val + ":" + val . getClass ( ) . getName ( ) + ")" ; } msg = msg + ":\n" + e . getClass ( ) . getName ( ) + ":\n" ; throw new CacheManagementException ( msg + e . getMessage ( ) ) ; } } }
Loads the specified values into the specified object instance.
@param item the object into which values are being loaded
@param vals the values to load into the object