org.dasein.attributes.types
Class CurrencyFactory.CurrencyAttribute

java.lang.Object
  extended by org.dasein.attributes.DataType<Currency>
      extended by org.dasein.attributes.types.CurrencyFactory.CurrencyAttribute
All Implemented Interfaces:
Serializable
Enclosing class:
CurrencyFactory

public static class CurrencyFactory.CurrencyAttribute
extends DataType<Currency>

Implementation of rules for currency attributes.

Last modified: $Date: 2006/03/25 06:17:05 $

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

Nested Class Summary
 
Nested classes/interfaces inherited from class org.dasein.attributes.DataType
DataType.InputType
 
Constructor Summary
CurrencyFactory.CurrencyAttribute(boolean ml, boolean mv, boolean req)
          Constructs a currency attribute that enables users to select among all installed currencies on the system.
CurrencyFactory.CurrencyAttribute(boolean ml, boolean mv, boolean req, String codes)
          Constructs a currency attribute instance in which the type parameters define a specific list of allowed currency codes.
 
Method Summary
 Collection<Currency> getChoices()
          Provides a list of values considered valid for this data type.
 DataTypeFactory<Currency> getFactory()
           
 DataType.InputType getInputType()
           
 Currency getValue(Object val)
          Provides a currency value based on a raw value.
 boolean isValidChoice(Currency curr)
          Validates that the specified currency is a valid value for this data type.
 String toString()
           
 
Methods inherited from class org.dasein.attributes.DataType
equals, 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

CurrencyFactory.CurrencyAttribute

public CurrencyFactory.CurrencyAttribute(boolean ml,
                                         boolean mv,
                                         boolean req)
Constructs a currency attribute that enables users to select among all installed currencies on the system.

Parameters:
ml - is the attribute multi-lingual?
mv - does the attribute allow multiple values?
req - is a value required for this attribute?

CurrencyFactory.CurrencyAttribute

public CurrencyFactory.CurrencyAttribute(boolean ml,
                                         boolean mv,
                                         boolean req,
                                         String codes)
Constructs a currency attribute instance in which the type parameters define a specific list of allowed currency codes. The codes are specified as a single, comma-delimited string.

Parameters:
ml - is this data type multi-lingual?
mv - does this data type allow multiple values?
req - does this data type require a value?
codes - a comma-delimited string defining acceptable currency codes
Method Detail

getChoices

public Collection<Currency> 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<Currency>
Returns:
the list of allowed currency values

getFactory

public DataTypeFactory<Currency> getFactory()
Specified by:
getFactory in class DataType<Currency>
Returns:
the factory for currency attributes

getInputType

public DataType.InputType getInputType()
Specified by:
getInputType in class DataType<Currency>
Returns:
if the data type is multi-valued, InputType#MULTI_SELECT, otherwise InputType#SELECT

getValue

public Currency getValue(Object val)
Provides a currency value based on a raw value. Valid raw values include Currency instances or currency codes as strings.

Specified by:
getValue in class DataType<Currency>
Parameters:
val - the raw value
Returns:
the currency matching the raw value

isValidChoice

public boolean isValidChoice(Currency curr)
Validates that the specified currency is a valid value for this data type. The specified currency is considered valid if it is among the choices setup for the data type.

Specified by:
isValidChoice in class DataType<Currency>
Parameters:
curr - the currency being validated
Returns:
true if the value is vvalid

toString

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