com.jgoodies.binding.value

Class ConverterFactory.BooleanToStringConverter

Enclosing Class:
ConverterFactory
Implemented Interfaces:
Observable, Serializable, ValueModel

public static final class ConverterFactory.BooleanToStringConverter
extends AbstractConverter

Converts Booleans to Strings and vice-versa using given texts for true, false, and null. Throws a ClassCastException if the value to convert is not a Boolean, or not a String for the reverse conversion.

Field Summary

Fields inherited from class com.jgoodies.binding.value.AbstractConverter

subject

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

PROPERTYNAME_VALUE

Method Summary

@Override
Object convertFromSubject(Object subjectValue)
Converts the subject value to associated text representation.
void
setValue(Object newValue)
Converts the given String and sets the associated Boolean as the subject's new value.

Methods inherited from class com.jgoodies.binding.value.AbstractConverter

convertFromSubject, getValue, release

Methods inherited from class com.jgoodies.binding.value.AbstractValueModel

String toString, addValueChangeListener, booleanValue, doubleValue, fireValueChange, fireValueChange, fireValueChange, fireValueChange, fireValueChange, fireValueChange, fireValueChange, floatValue, getString, intValue, longValue, removeValueChangeListener, setValue, setValue, setValue, setValue, setValue

Methods inherited from class com.jgoodies.binding.beans.Model

addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, equals, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, fireMultiplePropertiesChanged, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, getPropertyChangeListeners, getPropertyChangeListeners, getVetoableChangeListeners, getVetoableChangeListeners, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener

Method Details

Object convertFromSubject

public @Override Object convertFromSubject(Object subjectValue)
Converts the subject value to associated text representation. Rejects non-Boolean values.
Parameters:
subjectValue - the subject's new value
Returns:
the text that represents the subject value

setValue

public void setValue(Object newValue)
Converts the given String and sets the associated Boolean as the subject's new value. In case the new value equals neither this class' trueText, nor the falseText, nor the nullText, an IllegalArgumentException is thrown.
Specified by:
setValue in interface ValueModel
Parameters:
newValue - the value to be converted and set as new subject value

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