org.dasein.attributes.types
Class BooleanFactory.BooleanAttribute

java.lang.Object
  extended by org.dasein.attributes.DataType<Boolean>
      extended by org.dasein.attributes.types.BooleanFactory.BooleanAttribute
All Implemented Interfaces:
Serializable
Enclosing class:
BooleanFactory

public static class BooleanFactory.BooleanAttribute
extends DataType<Boolean>

Implements the rules around a boolean value.

Last modified: $Date: 2009/01/30 23:01:49 $

Version:
$Revision: 1.4 $
Author:
George Reese
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.dasein.attributes.DataType
DataType.InputType
 
Constructor Summary
BooleanFactory.BooleanAttribute(String grp, Number idx, boolean ml, boolean mv, boolean req)
          Constructs a boolean attribute instance.
 
Method Summary
 Collection<Boolean> getChoices()
          Provides a list of values considered valid for this data type.
 DataTypeFactory<Boolean> getFactory()
           
 DataType.InputType getInputType()
           
 Boolean getValue(Object val)
          Given a raw value from some source, this method will provide a Java Boolean instance.
 boolean isValidChoice(Boolean b)
          Verifies that the specified value is valid according to the rules of this data type.
 String toString()
           
 
Methods inherited from class org.dasein.attributes.DataType
equals, getGroup, getIndex, getName, getParameters, getSize, getTranslatedValue, getValues, hashCode, isMultiLingual, isMultiValued, isRequired
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BooleanFactory.BooleanAttribute

public BooleanFactory.BooleanAttribute(String grp,
                                       Number idx,
                                       boolean ml,
                                       boolean mv,
                                       boolean req)
Constructs a boolean attribute instance.

Parameters:
grp - the group of the data type.
idx - the index of the data type.
ml - true if the boolean is multi-lingual
mv - true if the boolean supports multiple values
req - true if a value is required
Method Detail

getChoices

public Collection<Boolean> getChoices()
Description copied from class: DataType
Provides a list of values considered valid for this data type. If any object of the type governed by this data type is allowed, this method will return null.

Specified by:
getChoices in class DataType<Boolean>
Returns:
true and false

getFactory

public DataTypeFactory<Boolean> getFactory()
Specified by:
getFactory in class DataType<Boolean>
Returns:
the factory that constructed this boolean attribute

getInputType

public DataType.InputType getInputType()
Specified by:
getInputType in class DataType<Boolean>
Returns:
a DataType.InputType.SELECT instance

getValue

public Boolean getValue(Object val)
Given a raw value from some source, this method will provide a Java Boolean instance. This raw value can be a string ('true' or 'false'), a boolean, or a number (non-zero is true, zero is false).

Specified by:
getValue in class DataType<Boolean>
Parameters:
val - the raw value
Returns:
the corresponding boolean value

isValidChoice

public boolean isValidChoice(Boolean b)
Verifies that the specified value is valid according to the rules of this data type. In practice, the only check it performs is whether or not a value is required when the parameter is null.

Specified by:
isValidChoice in class DataType<Boolean>
Parameters:
b - the value being validated
Returns:
true if the specified value is valid for this type's rules

toString

public String toString()
Overrides:
toString in class DataType<Boolean>
Returns:
a string representation of this data type


Copyright © 2011 enStratus Networks LLC. All Rights Reserved.