cdm/src/main/java/ucar/util/prefs/PreferencesExt.java
public Object getBean(String key, Object def) {
      if (key==null)
        throw new NullPointerException("Null key");
      if (isRemoved())
        throw new IllegalStateException("Node has been removed.");

      synchronized(lock) {
        Object result = null;
        try {
          result = _getObject( key);
          if (result != null) {
            if (result instanceof Bean.Collection)
              result = ((Bean.Collection)result).getCollection();
            else if (result instanceof Bean)
              result = ((Bean)result).getObject();
          }
        } catch (Exception e) {
          // Ignoring exception causes default to be returned
        }
        return (result==null ? def : result);
      }
    }
public Object getBean(String key, Object def) {
      if (key==null)
        throw new NullPointerException("Null key");
      if (isRemoved())
        throw new IllegalStateException("Node has been removed.");

      synchronized(lock) {
        Object result = null;
        try {
          result = _getObject( key);
          if (result != null) {
            if (result instanceof Bean.Collection)
              result = ((Bean.Collection)result).getCollection();
            else if (result instanceof Bean)
              result = ((Bean)result).getObject();
          }
        } catch (Exception e) {
          // Ignoring exception causes default to be returned
        }
        return (result==null ? def : result);
      }
    }
public Object getBean ( String key , Object def ) { if ( key == null ) throw new NullPointerException ( "Null key" ) ; if ( isRemoved ( ) ) throw new IllegalStateException ( "Node has been removed." ) ; synchronized ( lock ) { Object result = null ; try { result = _getObject ( key ) ; if ( result != null ) { if ( result instanceof Bean . Collection ) result = ( ( Bean . Collection ) result ) . getCollection ( ) ; else if ( result instanceof Bean ) result = ( ( Bean ) result ) . getObject ( ) ; } } catch ( Exception e ) { // Ignoring exception causes default to be returned } return ( result == null ? def : result ) ; } }
Get the object that has the specified key.
This returns the object itself, not a copy, so
if you change the bean and call store.save(), any changes to the object will be saved,
even without calling putBean(). If you want to change the object without saving the
changes, you must make a copy of the object yourself.

@param key get the object with this key.
@param def the default value to be returned in the event that this
preference node has no value associated with <tt>key</tt>.
@return the value associated with <tt>key</tt>, or <tt>def</tt>
if no value is associated with <tt>key</tt>.
@throws IllegalStateException if this node (or an ancestor) has been
removed with the {@link #removeNode()} method.
@throws NullPointerException if key is <tt>null</tt>.  (A
<tt>null</tt> default <i>is</i> permitted.)
Get the object that has the specified key . This returns the object itself not a copy so if you change the bean and call store . save () any changes to the object will be saved even without calling putBean () . If you want to change the object without saving the changes you must make a copy of the object yourself .