org.globus.cog.gridshell.getopt.app
Class StorableImpl

java.lang.Object
  extended byorg.globus.cog.gridshell.getopt.app.StorableImpl
All Implemented Interfaces:
Storable
Direct Known Subclasses:
ArgumentImpl, OptionImpl

public class StorableImpl
extends Object
implements Storable

An implemenation of Storable


Constructor Summary
StorableImpl(String description, Class type, boolean isRequired, Object defaultValue)
          A Constructor for a Storable
 
Method Summary
 String getDescription()
          Returns the description
 Class getType()
          Returns the type
static Map getValidators()
          Returns an immutable mapping of validators
 Object getValue()
          Returns the value based upon the validator associated with this type
 boolean isRequired()
          Tells if this is required or not
 boolean isSet()
          Sees if this is set to non-null and not FALSE
static void resetDefaultValidators()
          Remove all validators and then sets the default validators, synchronized on validators
static void setValidator(Class type, Validator validator)
          Adds a validator
 void setValue(Object value)
          Sets the value, if it is a String it reuses the validator associated with this type
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StorableImpl

public StorableImpl(String description,
                    Class type,
                    boolean isRequired,
                    Object defaultValue)
A Constructor for a Storable

Parameters:
description - - the description
type - - The type of this storable
isRequired - - Is this storable requried
defaultValue - - A default value for the storable
Method Detail

resetDefaultValidators

public static void resetDefaultValidators()
Remove all validators and then sets the default validators, synchronized on validators


setValidator

public static void setValidator(Class type,
                                Validator validator)
Adds a validator

Parameters:
type - - the type identified by a class that will be validated
validator - - the validator for the class, if it is null removes a validator for this class

getValidators

public static Map getValidators()
Returns an immutable mapping of validators

Returns:

getDescription

public String getDescription()
Description copied from interface: Storable
Returns the description

Specified by:
getDescription in interface Storable
Returns:

getType

public Class getType()
Description copied from interface: Storable
Returns the type

Specified by:
getType in interface Storable
Returns:

getValue

public Object getValue()
Description copied from interface: Storable
Returns the value based upon the validator associated with this type

Specified by:
getValue in interface Storable
Returns:

isRequired

public boolean isRequired()
Description copied from interface: Storable
Tells if this is required or not

Specified by:
isRequired in interface Storable
Returns:

isSet

public boolean isSet()
Description copied from interface: Storable
Sees if this is set to non-null and not FALSE

Specified by:
isSet in interface Storable
Returns:

setValue

public void setValue(Object value)
Description copied from interface: Storable
Sets the value, if it is a String it reuses the validator associated with this type

Specified by:
setValue in interface Storable
Parameters:
value -

toString

public String toString()