Joda System API

org.joda.property.impl.type
Class AbstractBooleanicProperty

java.lang.Object
  |
  +--org.joda.property.impl.AbstractModelElement
        |
        +--org.joda.property.impl.AbstractProperty
              |
              +--org.joda.property.impl.type.AbstractBooleanicProperty
All Implemented Interfaces:
BooleanicProperty, DataProperty, InitializableProperty, ModelElement, Property, Property.Internal, java.io.Serializable
Direct Known Subclasses:
DefaultBooleanPrimitiveProperty, DefaultBooleanProperty

public abstract class AbstractBooleanicProperty
extends AbstractProperty
implements BooleanicProperty

Default implementation of a Booleanic property.

Data is stored in the associated PropertyData object as a Boolean object. This is immutable so can be directly returned.

Author:
Stephen Colebourne
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class org.joda.property.Property
Property.Internal
 
Constructor Summary
AbstractBooleanicProperty()
          Constructor
 
Method Summary
 boolean booleanValue()
          Get the property's value as a boolean.
protected  java.lang.Boolean convertObjectToBoolean(java.lang.Object object)
          Convert an Object to a Boolean, throwing an exception if unable to convert.
protected  java.lang.Boolean getInternal()
          Get the property as a Boolean
 boolean isFalse()
          Is the property value currently in a 'false' state.
 boolean isTrue()
          Is the property value currently in a 'true' state.
 void negate()
          Negate the current value of the property.
 void set(boolean propertyValue)
          Set the property's value.
 void set(java.lang.Object propertyValue)
          Set the property's value as an object.
protected  void setInternal(java.lang.Boolean newValue)
          Set the property value as a Boolean
 java.lang.Boolean toBoolean()
          Get the property's value as a Boolean.
 java.lang.Object toObject()
          Get the property's value as an object.
 
Methods inherited from class org.joda.property.impl.AbstractProperty
addPropertyChangeListener, bean, checkArgumentNotNull, checkModifiable, checkValueNotNull, checkValueNotNull, cloneDeep, convertObject, createClonedProperty, data, equals, equalsValue, firePropertyChange, firePropertyChange, getContentName, getContentType, getPropertyName, getThis, hashCode, initBeanCreated, initPropertyCreated, isModifiable, isNull, isReadOnly, populateClonedProperty, removePropertyChangeListener, setModifiable, setReadOnly, toDataString, toString
 
Methods inherited from class org.joda.property.impl.AbstractModelElement
getAttribute, getAttributeCount, getAttributeMap, setAttribute
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.joda.property.type.DataProperty
toDataString
 
Methods inherited from interface org.joda.property.Property
addPropertyChangeListener, bean, equals, equalsValue, firePropertyChange, getContentName, getContentType, getPropertyName, getPropertyType, hashCode, isModifiable, isNull, isReadOnly, removePropertyChangeListener, setModifiable, setReadOnly, toString
 
Methods inherited from interface org.joda.property.ModelElement
getAttribute, getAttributeCount, getAttributeMap, setAttribute
 

Constructor Detail

AbstractBooleanicProperty

public AbstractBooleanicProperty()
Constructor

Method Detail

getInternal

protected java.lang.Boolean getInternal()
Get the property as a Boolean

Returns:
the stored value

setInternal

protected void setInternal(java.lang.Boolean newValue)
Set the property value as a Boolean

Parameters:
newValue - the value to store

toObject

public java.lang.Object toObject()
Description copied from interface: Property
Get the property's value as an object. The object type will be appropriate for the type of property. The object will either be immutable or a clone of the real object.

This method has strong semantics such that where a and b are properties of the same type, it must be true that:
b.set( a.toObject() ); a.equals(b);
In other words, the object contains all the data necessary to recreate the property's value.

Specified by:
toObject in interface Property
Specified by:
toObject in class AbstractProperty
Returns:
an Object representing the property's value
See Also:
Property#toObject()

toBoolean

public java.lang.Boolean toBoolean()
Description copied from interface: BooleanicProperty
Get the property's value as a Boolean.

Specified by:
toBoolean in interface BooleanicProperty
Returns:
the property value as a Boolean
See Also:
BooleanProperty#toBoolean()

booleanValue

public boolean booleanValue()
Description copied from interface: BooleanicProperty
Get the property's value as a boolean.

Specified by:
booleanValue in interface BooleanicProperty
Returns:
the property value as a boolean
See Also:
BooleanProperty#booleanValue()

isTrue

public boolean isTrue()
Description copied from interface: BooleanicProperty
Is the property value currently in a 'true' state. Note that is perfectly possible for both isTrue() and isFalse() to return false at the same time, but they cannot both return true. No exceptions are thrown.

Specified by:
isTrue in interface BooleanicProperty
Returns:
true if the property is currently 'true'
See Also:
BooleanProperty#isTrue()

isFalse

public boolean isFalse()
Description copied from interface: BooleanicProperty
Is the property value currently in a 'false' state. Note that is perfectly possible for both isTrue() and isFalse() to return false at the same time, but they cannot both return true. No exceptions are thrown.

Specified by:
isFalse in interface BooleanicProperty
Returns:
true if the property is currently false
See Also:
BooleanProperty#isFalse()

convertObjectToBoolean

protected java.lang.Boolean convertObjectToBoolean(java.lang.Object object)
Convert an Object to a Boolean, throwing an exception if unable to convert.

Parameters:
object - the value to convert
Returns:
the converted boolean

set

public void set(java.lang.Object propertyValue)
Description copied from interface: Property
Set the property's value as an object. The object type should be appropriate for the type of property. If necessary, the object will be cloned before it is stored internally. Implementations will recognise as many types of object passed in as possible. Null should always be accepted, primitive types will be reset back to zero/false.

If a String is passed in, it can be parsed in various ways. If the results of toDataString() are passed in, it must reconstitute the original value.

Specified by:
set in interface Property
Specified by:
set in class AbstractProperty
Parameters:
propertyValue - an Object to set the property's value to
See Also:
Property#set(Object)

set

public void set(boolean propertyValue)
Description copied from interface: BooleanicProperty
Set the property's value.

Specified by:
set in interface BooleanicProperty
Parameters:
propertyValue - a value to set the property's value to
See Also:
BooleanProperty#set(boolean)

negate

public void negate()
Description copied from interface: BooleanicProperty
Negate the current value of the property. If the value is currently null, it will be unchanged and no exception will be thrown.

Specified by:
negate in interface BooleanicProperty
See Also:
BooleanProperty#negate()

Joda System API

Copyright © 2001-2003 Stephen Colebourne. All Rights Reserved.