com.jgoodies.binding.value
Class ConverterFactory.BooleanNegator

java.lang.Object
  extended by com.jgoodies.binding.value.ConverterFactory.BooleanNegator
All Implemented Interfaces:
BindingConverter
Enclosing class:
ConverterFactory

public static final class ConverterFactory.BooleanNegator
extends Object
implements BindingConverter

Negates Booleans leaving null unchanged. Maps Boolean.TRUE to Boolean.FALSE, Boolean.FALSE to Boolean.TRUE, and null to null.


Constructor Summary
ConverterFactory.BooleanNegator()
           
 
Method Summary
 Object sourceValue(Object targetValue)
          Inverts the given Boolean and sets it as the subject's new value.
 Object targetValue(Object sourceValue)
          Negates Booleans leaving null unchanged.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConverterFactory.BooleanNegator

public ConverterFactory.BooleanNegator()
Method Detail

targetValue

public Object targetValue(Object sourceValue)
Negates Booleans leaving null unchanged. Maps Boolean.TRUE to Boolean.FALSE, Boolean.FALSE to Boolean.TRUE, and null to null.

Specified by:
targetValue in interface BindingConverter
Parameters:
sourceValue - the subject value to invert
Returns:
the text that represents the subject value
Throws:
ClassCastException - if the subject's value is not a Boolean

sourceValue

public Object sourceValue(Object targetValue)
Inverts the given Boolean and sets it as the subject's new value.

Specified by:
sourceValue in interface BindingConverter
Parameters:
targetValue - the value to be inverted and set as new subject value
Returns:
the converted value
Throws:
ClassCastException - if the new value is not a Boolean
IllegalArgumentException - if the new value does neither match the trueText nor the falseText


Copyright © 2002-2013 JGoodies Software GmbH. All Rights Reserved.