org.geotools.data
Class DataAccessFactory.Param

Object
  extended by Parameter
      extended by DataAccessFactory.Param
Direct Known Subclasses:
WFSDataStoreFactory.WFSFactoryParam
Enclosing interface:
DataAccessFactory

public static class DataAccessFactory.Param
extends Parameter

Data class used to capture Parameter requirements.

Subclasses may provide specific setAsText()/getAsText() requirements

Warning: We would like to start moving towards a common paraemters framework with GridCoverageExchnage. Param will be maintained as a wrapper for one point release (at which time it will be deprecated).


Field Summary
 
Fields inherited from class Parameter
CRS, description, ELEMENT, EXT, FEATURE_TYPE, IS_PASSWORD, key, LENGTH, LEVEL, MAX, maxOccurs, metadata, MIN, minOccurs, required, sample, title, type
 
Constructor Summary
DataAccessFactory.Param(String key)
          Provides support for text representations The parameter type of String is assumed.
DataAccessFactory.Param(String key, Class<?> type)
          Provides support for text representations.
DataAccessFactory.Param(String key, Class<?> type, String description)
          Provides support for text representations
DataAccessFactory.Param(String key, Class<?> type, String description, boolean required)
          Provides support for text representations
DataAccessFactory.Param(String key, Class<?> type, String description, boolean required, Object sample)
          Provides support for text representations
DataAccessFactory.Param(String key, Class type, InternationalString description, boolean required, Object sample)
          Provides support for text representations
DataAccessFactory.Param(String key, Class type, InternationalString description, boolean required, Object sample, Map<String,?> metadata)
          Provides support for text representations
DataAccessFactory.Param(String key, Class type, String description, boolean required, Object sample, Map<String,?> metadata)
          Provides support for text representations
DataAccessFactory.Param(String key, Class type, String description, boolean required, Object sample, Object... metadata)
           
 
Method Summary
 Object handle(String text)
          Handle text in a sensible manner.
 Object lookUp(Map<String,?> map)
          Lookup Param in a user supplied map.
 Object parse(String text)
          Provides support for text representations Provides basic support for common types using reflection.
 String text(Object value)
          Convert value to text representation for this Parameter
 String toString()
          key=Type description
 
Methods inherited from class Parameter
getLevel, isPassword
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DataAccessFactory.Param

public DataAccessFactory.Param(String key)
Provides support for text representations

The parameter type of String is assumed.

Parameters:
key - Key used to file this Param in the Parameter Map for createDataStore

DataAccessFactory.Param

public DataAccessFactory.Param(String key,
                               Class<?> type)
Provides support for text representations.

You may specify a type for this Param.

Parameters:
key - Key used to file this Param in the Parameter Map for createDataStore
type - Class type intended for this Param

DataAccessFactory.Param

public DataAccessFactory.Param(String key,
                               Class<?> type,
                               String description)
Provides support for text representations

Parameters:
key - Key used to file this Param in the Parameter Map for createDataStore
type - Class type intended for this Param
description - User description of Param (40 chars or less)

DataAccessFactory.Param

public DataAccessFactory.Param(String key,
                               Class<?> type,
                               String description,
                               boolean required)
Provides support for text representations

Parameters:
key - Key used to file this Param in the Parameter Map for createDataStore
type - Class type intended for this Param
description - User description of Param (40 chars or less)
required - true is param is required

DataAccessFactory.Param

public DataAccessFactory.Param(String key,
                               Class<?> type,
                               String description,
                               boolean required,
                               Object sample)
Provides support for text representations

Parameters:
key - Key used to file this Param in the Parameter Map for createDataStore
type - Class type intended for this Param
description - User description of Param (40 chars or less)
required - true is param is required
sample - Sample value as an example for user input

DataAccessFactory.Param

public DataAccessFactory.Param(String key,
                               Class type,
                               InternationalString description,
                               boolean required,
                               Object sample)
Provides support for text representations

Parameters:
key - Key used to file this Param in the Parameter Map for createDataStore
type - Class type intended for this Param
description - User description of Param (40 chars or less)
required - true is param is required
sample - Sample value as an example for user input

DataAccessFactory.Param

public DataAccessFactory.Param(String key,
                               Class type,
                               String description,
                               boolean required,
                               Object sample,
                               Map<String,?> metadata)
Provides support for text representations

Parameters:
key - Key used to file this Param in the Parameter Map for createDataStore
type - Class type intended for this Param
description - User description of Param (40 chars or less)
required - true is param is required
sample - Sample value as an example for user input
extra - metadata information, preferably keyed by known identifiers like Parameter.IS_PASSWORD

DataAccessFactory.Param

public DataAccessFactory.Param(String key,
                               Class type,
                               String description,
                               boolean required,
                               Object sample,
                               Object... metadata)

DataAccessFactory.Param

public DataAccessFactory.Param(String key,
                               Class type,
                               InternationalString description,
                               boolean required,
                               Object sample,
                               Map<String,?> metadata)
Provides support for text representations

Parameters:
key - Key used to file this Param in the Parameter Map for createDataStore
type - Class type intended for this Param
description - User description of Param (40 chars or less)
required - true is param is required
sample - Sample value as an example for user input
extra - metadata information, preferably keyed by known identifiers like Parameter.IS_PASSWORD
Method Detail

lookUp

public Object lookUp(Map<String,?> map)
              throws IOException
Lookup Param in a user supplied map.

Type conversion will occur if required, this may result in an IOException. An IOException will be throw in the Param is required and the Map does not contain the Map.

The handle method is used to process the user's value.

Parameters:
map - Map of user input
Returns:
Parameter as specified in map
Throws:
IOException - if parse could not handle value

text

public String text(Object value)
Convert value to text representation for this Parameter

Parameters:
value - DOCUMENT ME!
Returns:
DOCUMENT ME!

handle

public Object handle(String text)
              throws IOException
Handle text in a sensible manner.

Performs the most common way of handling text value:

Parameters:
text -
Returns:
Value as processed by text
Throws:
IOException - If text could not be parsed
DataSourceException - DOCUMENT ME!

parse

public Object parse(String text)
             throws Throwable
Provides support for text representations

Provides basic support for common types using reflection.

If needed you may extend this class to handle your own custome types.

Parameters:
text - Text representation of type should not be null or empty
Returns:
Object converted from text representation
Throws:
Throwable - DOCUMENT ME!
IOException - If text could not be parsed
DataSourceException - DOCUMENT ME!

toString

public String toString()
key=Type description

Overrides:
toString in class Object


Copyright © 1996-2009 Geotools. All Rights Reserved.