org.springframework.binding.value.support
Class MessageFormatValueModel

java.lang.Object
  extended by org.springframework.binding.value.support.AbstractPropertyChangePublisher
      extended by org.springframework.binding.value.support.AbstractValueModel
          extended by org.springframework.binding.value.support.AbstractDerivedValueModel
              extended by org.springframework.binding.value.support.MessageFormatValueModel
All Implemented Interfaces:
DerivedValueModel, PropertyChangePublisher, ValueModel

public class MessageFormatValueModel
extends AbstractDerivedValueModel

A value model that takes a set of "argument" ValueModels, formats their values into strings, and then inserts these formatted strings into the provided pattern at the appropriate places. Any changes to the "argument" ValueModels will cause this value model to also update.

Author:
Oliver Hutchison
See Also:
MessageFormat

Field Summary
 
Fields inherited from class org.springframework.binding.value.support.AbstractValueModel
logger
 
Fields inherited from interface org.springframework.binding.value.ValueModel
VALUE_PROPERTY
 
Constructor Summary
MessageFormatValueModel(String pattern, ValueModel argumentValueModel)
          Constructs a new MessageFormatValueModel with a single argument.
MessageFormatValueModel(String pattern, ValueModel[] argumentValueModels)
          Constructs a new MessageFormatValueModel with a group of arguments.
 
Method Summary
 Object getValue()
          Returns this model's value.
protected  void sourceValuesChanged()
          Derive the value from the source values and fire a valueChangeEvent to notify listeners.
 
Methods inherited from class org.springframework.binding.value.support.AbstractDerivedValueModel
getSourceValueModels, getSourceValues, isReadOnly, setValue
 
Methods inherited from class org.springframework.binding.value.support.AbstractValueModel
addValueChangeListener, fireValueChange, fireValueChange, fireValueChange, fireValueChange, fireValueChange, fireValueChangeEvent, fireValueChangeWhenStillEqual, getValueChangeDetector, hasValueChanged, removeValueChangeListener, setValueChangeDetector, setValueSilently
 
Methods inherited from class org.springframework.binding.value.support.AbstractPropertyChangePublisher
addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, firePropertiesChanged, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, getPropertyChangeListeners, getPropertyChangeListeners, getVetoableChangeListeners, getVetoableChangeListeners, hasChanged, hasChanged, hasChanged, hasChanged, hasChanged, hasChanged, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.springframework.binding.value.ValueModel
addValueChangeListener, removeValueChangeListener, setValueSilently
 

Constructor Detail

MessageFormatValueModel

public MessageFormatValueModel(String pattern,
                               ValueModel argumentValueModel)
Constructs a new MessageFormatValueModel with a single argument.

Parameters:
pattern - the pattern
argumentValueModel - the single value model holding the value to be formatted and substituted

MessageFormatValueModel

public MessageFormatValueModel(String pattern,
                               ValueModel[] argumentValueModels)
Constructs a new MessageFormatValueModel with a group of arguments.

Parameters:
pattern - the pattern
argumentValueModels - an array of value models holding the value to be formatted and substituted
Method Detail

sourceValuesChanged

protected void sourceValuesChanged()
Description copied from class: AbstractDerivedValueModel
Derive the value from the source values and fire a valueChangeEvent to notify listeners.

Specified by:
sourceValuesChanged in class AbstractDerivedValueModel

getValue

public Object getValue()
Description copied from interface: ValueModel
Returns this model's value. In case of a write-only value, implementers may choose to either reject this operation or or return null or any other appropriate value.

Returns:
this model's value


Copyright © 2004-2008 The Spring Framework. All Rights Reserved.