Package org.geotools.api.data
Class DataAccessFactory.Param
-
- All Implemented Interfaces:
Parameter
- Direct Known Subclasses:
WFSDataAccessFactory.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
-
-
Field Summary
-
Fields inherited from class Parameter
CRS, DEPRECATED, description, ELEMENT, EXT, FEATURE_TYPE, IS_LARGE_TEXT, IS_PASSWORD, key, LENGTH, LEVEL, MAX, maxOccurs, metadata, MIN, minOccurs, OPTIONS, required, sample, title, type
-
-
Constructor Summary
Constructors Constructor Description Param(String key)
Provides support for text representationsParam(String key, Class<?> type)
Provides support for text representations.Param(String key, Class<?> type, String description)
Provides support for text representationsParam(String key, Class<?> type, String description, boolean required)
Provides support for text representationsParam(String key, Class<?> type, String description, boolean required, Object sample)
Provides support for text representationsParam(String key, Class<?> type, String description, boolean required, Object sample, Object... metadata)
Param(String key, Class<?> type, String description, boolean required, Object sample, Map<String,?> metadata)
Provides support for text representationsParam(String key, Class<?> type, InternationalString description, boolean required, Object sample)
Provides support for text representationsParam(String key, Class<?> type, InternationalString description, boolean required, Object sample, Map<String,?> metadata)
Provides support for text representationsParam(String key, Class<?> type, InternationalString title, InternationalString description, boolean required, int min, int max, Object sample, Map<String,?> metadata)
Supports all Parameter values.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 representationsString
text(Object value)
Convert value to text representation for this ParameterString
toString()
key=Type description-
Methods inherited from class Parameter
equals, getDefaultValue, getDescription, getLevel, getMaxOccurs, getMinOccurs, getName, getTitle, getType, hashCode, isDeprecated, isPassword, isRequired
-
-
-
-
Constructor Detail
-
Param
public Param(String key)
Provides support for text representationsThe parameter type of String is assumed.
- Parameters:
key
- Key used to file this Param in the Parameter Map for createDataStore
-
Param
public 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 createDataStoretype
- Class type intended for this Param
-
Param
public 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 createDataStoretype
- Class type intended for this Paramdescription
- User description of Param (40 chars or less)
-
Param
public 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 createDataStoretype
- Class type intended for this Paramdescription
- User description of Param (40 chars or less)required
-true
is param is required
-
Param
public 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 createDataStoretype
- Class type intended for this Paramdescription
- User description of Param (40 chars or less)required
-true
is param is requiredsample
- Sample value as an example for user input
-
Param
public 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 createDataStoretype
- Class type intended for this Paramdescription
- User description of Param (40 chars or less)required
-true
is param is requiredsample
- Sample value as an example for user input
-
Param
public 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 createDataStoretype
- Class type intended for this Paramdescription
- User description of Param (40 chars or less)required
-true
is param is requiredsample
- Sample value as an example for user inputmetadata
- metadata information, preferably keyed by known identifiers likeParameter.IS_PASSWORD
-
Param
public Param(String key, Class<?> type, String description, boolean required, Object sample, Object... metadata)
-
Param
public 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 createDataStoretype
- Class type intended for this Paramdescription
- User description of Param (40 chars or less)required
-true
is param is requiredsample
- Sample value as an example for user inputmetadata
- metadata information, preferably keyed by known identifiers likeParameter.IS_PASSWORD
-
Param
public Param(String key, Class<?> type, InternationalString title, InternationalString description, boolean required, int min, int max, Object sample, Map<String,?> metadata)
Supports all Parameter values.- Parameters:
key
- machine readable key for use in a java.util.Maptype
- Java class for the expected valuetitle
- Human readable title used for use in a user interfacedescription
- Human readable descriptionrequired
- true if the value is requiredmin
- Minimum value; or -1 if not neededmax
- Maximum value; or -1 for unboundsample
- Sample value; may be used as a default in a user interfacemetadata
- Hints to the user interface (read the javadocs for each metadata key)
-
-
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
-
handle
public Object handle(String text) throws IOException
Handle text in a sensible manner.Performs the most common way of handling text value:
- null: If text is null
- original text: if type == String.class
- first character of original text: if type == Character.class
- null: if type != String.class and text.getLength == 0
- parse( text ): if type != String.class
- Returns:
- Value as processed by text
- Throws:
IOException
- If text could not be parsed
-
parse
public Object parse(String text) throws Throwable
Provides support for text representationsProvides 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:
IOException
- If text could not be parsedThrowable
-
-