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

## org.apache.commons.lang.mutable
Class MutableBoolean

    java.lang.Object
      org.apache.commons.lang.mutable.MutableBoolean

All Implemented Interfaces:
  java.lang.Comparable, Mutable, java.io.Serializable

public class MutableBoolean
extends java.lang.Object
implements Mutable, java.io.Serializable, java.lang.Comparable

A mutable `boolean` wrapper.

Since:
  2.2
Version:
  $Id: MutableBoolean.java 491052 2006-12-29 17:16:37Z scolebourne $
Author:
  Apache Software Foundation
See Also:
  `Boolean`, Serialized Form

Constructor Summary
`MutableBoolean()` Constructs a new MutableBoolean with the default value of false.
`MutableBoolean(boolean value)` Constructs a new MutableBoolean with the specified value.
`MutableBoolean(java.lang.Boolean value)` Constructs a new MutableBoolean with the specified value.

Method Summary
`boolean` | `booleanValue()` Returns the value of this MutableBoolean as a boolean.
`int` | `compareTo(java.lang.Object obj)` Compares this mutable to another in ascending order.
`boolean` | `equals(java.lang.Object obj)` Compares this object to the specified object.
`java.lang.Object` | `getValue()` Gets the value as a Boolean instance.
`int` | `hashCode()` Returns a suitable hashcode for this mutable.
`void` | `setValue(boolean value)` Sets the value.
`void` | `setValue(java.lang.Object value)` Sets the value from any Boolean instance.
`java.lang.String` | `toString()` Returns the String value of this mutable.

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

Constructor Detail

### MutableBoolean

    public MutableBoolean()

  Constructs a new MutableBoolean with the default value of false.

### MutableBoolean

    public MutableBoolean(boolean value)

  Constructs a new MutableBoolean with the specified value.

Parameters:
  `value` - a value.

### MutableBoolean

    public MutableBoolean(java.lang.Boolean value)

  Constructs a new MutableBoolean with the specified value.

Parameters:
  `value` - a value.
Throws:
  `java.lang.NullPointerException` - if the object is null

Method Detail

### booleanValue

    public boolean booleanValue()

  Returns the value of this MutableBoolean as a boolean.

  Returns:
    the boolean value represented by this object.

### compareTo

    public int compareTo(java.lang.Object obj)

  Compares this mutable to another in ascending order.

  Specified by:
    `compareTo` in interface `java.lang.Comparable`
  Parameters:
    `obj` - the mutable to compare to
  Returns:
    zero if this object represents the same boolean value as the argument; a positive value if this object represents true and the argument represents false; and a negative value if this object represents false and the argument represents true
  Throws:
    `java.lang.ClassCastException` - if the argument is not a MutableInt

### equals

    public boolean equals(java.lang.Object obj)

  Compares this object to the specified object. The result is `true` if and only if the argument is not `null` and is an `MutableBoolean` object that contains the same `boolean` value as this object.

  Parameters:
    `obj` - the object to compare with.
  Returns:
    `true` if the objects are the same; `false` otherwise.

### getValue

    public java.lang.Object getValue()

  Gets the value as a Boolean instance.

  Specified by:
    `getValue` in interface `Mutable`
  Returns:
    the value as a Boolean

### hashCode

    public int hashCode()

  Returns a suitable hashcode for this mutable.

  Returns:
    the integer `1231` if this object represents `true`; returns the integer `1237` if this object represents `false`.

### setValue

    public void setValue(boolean value)

  Sets the value.

  Parameters:
    `value` - the value to set

### setValue

    public void setValue(java.lang.Object value)

  Sets the value from any Boolean instance.

  Specified by:
    `setValue` in interface `Mutable`
  Parameters:
    `value` - the value to set
  Throws:
    `java.lang.NullPointerException` - if the object is null
    `java.lang.ClassCastException` - if the type is not a `Boolean`

### toString

    public java.lang.String toString()

  Returns the String value of this mutable.

  Returns:
    the mutable value as a string

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 © 2001-2008 The Apache Software Foundation. All Rights Reserved.