Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.jgoodies.binding.extras
Class NonNullValueModel

    java.lang.Object
      com.jgoodies.binding.beans.Model
          com.jgoodies.binding.value.AbstractValueModel
              com.jgoodies.binding.extras.NonNullValueModel

All Implemented Interfaces:
  Observable, ValueModel, Serializable

    public final class NonNullValueModel

extends AbstractValueModel

A `ValueModel` implementation that avoids `null` values. It wraps another ValueModel and returns a (non-null) default value if the wrapped ValueModel returns null.

Note that value change events fired by this model may use null as old and/or new value. This is because PropertyChangeEvents use null to indicate that the old and/or new value is not provided by the event.

Note: This class is not yet part of the binary Binding library; it comes with the Binding distributions as an extra. The API is work in progress and may change without notice; this class may even be completely removed from future distributions. If you want to use this class, you may consider copying it into your codebase.

Since:
  1.1
Version:
  $Revision: 1.3 $
Author:
  Karsten Lentzsch
See Also:
  Serialized Form

Field Summary

Fields inherited from class com.jgoodies.binding.value.AbstractValueModel
`PROPERTYNAME_VALUE`

Constructor Summary
`NonNullValueModel(ValueModel subject, Object defaultValue)` Constructs an NonNullValueModel for the given ValueModel.

Method Summary
`Object` | `getValue()` Returns this model's current subject value.
`void` | `setValue(Object newValue)` Sets the given value to the wrapped ValueModel.

Methods inherited from class com.jgoodies.binding.value.AbstractValueModel
`addValueChangeListener, booleanValue, doubleValue, fireValueChange, fireValueChange, fireValueChange, fireValueChange, fireValueChange, fireValueChange, fireValueChange, floatValue, getString, intValue, longValue, removeValueChangeListener, setValue, setValue, setValue, setValue, setValue, toString`

Methods inherited from class com.jgoodies.binding.beans.Model
`addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, equals, fireMulticastPropertyChange, fireMultiplePropertiesChanged, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, getPropertyChangeListeners, getPropertyChangeListeners, getVetoableChangeListeners, getVetoableChangeListeners, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### NonNullValueModel

    public NonNullValueModel(ValueModel subject,
                             Object defaultValue)

  Constructs an NonNullValueModel for the given ValueModel.

  Parameters:
    `subject` - the underlying (or wrapped) ValueModel
    `defaultValue` - the value used whenever the wrapped model returns `null`
  Throws:
    `NullPointerException` - if the subject or defaultValue is `null`

Method Detail

### getValue

    public Object getValue()

  Returns this model's current subject value.

  Returns:
    this model's current subject value.

### setValue

    public void setValue(Object newValue)

  Sets the given value to the wrapped ValueModel. The value set can be `null`.

  Parameters:
    `newValue` - the value to set

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002-2006 JGoodies Karsten Lentzsch. All Rights Reserved.