public static class DataAccessFactory.Param extends Parameter
Subclasses may provide specific setAsText()/getAsText() requirements
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 and Description |
---|
Param(String key)
Provides support for text representations
The parameter type of String is assumed.
|
Param(String key,
Class<?> type)
Provides support for text representations.
|
Param(String key,
Class<?> type,
InternationalString description,
boolean required,
Object sample)
Provides support for text representations
|
Param(String key,
Class<?> type,
InternationalString description,
boolean required,
Object sample,
Map<String,?> metadata)
Provides support for text representations
|
Param(String key,
Class<?> type,
InternationalString title,
InternationalString description,
boolean required,
int min,
int max,
Object sample,
Map<String,?> metadata)
Supports all Parameter values.
|
Param(String key,
Class<?> type,
String description)
Provides support for text representations
|
Param(String key,
Class<?> type,
String description,
boolean required)
Provides support for text representations
|
Param(String key,
Class<?> type,
String description,
boolean required,
Object sample)
Provides support for text representations
|
Param(String key,
Class<?> type,
String description,
boolean required,
Object sample,
Map<String,?> metadata)
Provides support for text representations
|
Param(String key,
Class<?> type,
String description,
boolean required,
Object sample,
Object... metadata) |
Modifier and Type | Method and 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 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
|
equals, getDefaultValue, getDescription, getLevel, getMaxOccurs, getMinOccurs, getName, getTitle, getType, hashCode, isDeprecated, isPassword, isRequired
public Param(String key)
The parameter type of String is assumed.
key
- Key used to file this Param in the Parameter Map for createDataStorepublic Param(String key, Class<?> type)
You may specify a type
for this Param.
key
- Key used to file this Param in the Parameter Map for createDataStoretype
- Class type intended for this Parampublic Param(String key, Class<?> type, String description)
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)public Param(String key, Class<?> type, String description, boolean required)
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 requiredpublic Param(String key, Class<?> type, String description, boolean required, Object sample)
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 inputpublic Param(String key, Class<?> type, InternationalString description, boolean required, Object sample)
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 inputpublic Param(String key, Class<?> type, String description, boolean required, Object sample, Map<String,?> metadata)
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 inputextra
- metadata information, preferably keyed by known identifiers like Parameter.IS_PASSWORD
public Param(String key, Class<?> type, String description, boolean required, Object sample, Object... metadata)
public Param(String key, Class<?> type, InternationalString description, boolean required, Object sample, Map<String,?> metadata)
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 inputextra
- metadata information, preferably keyed by known identifiers like Parameter.IS_PASSWORD
public Param(String key, Class<?> type, InternationalString title, InternationalString description, boolean required, int min, int max, Object sample, Map<String,?> metadata)
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)public Object lookUp(Map<String,?> map) throws IOException
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.
map
- Map of user inputIOException
- if parse could not handle valuepublic String text(Object value)
value
- DOCUMENT ME!public Object handle(String text) throws IOException
Performs the most common way of handling text value:
text
- IOException
- If text could not be parsedpublic Object parse(String text) throws Throwable
Provides basic support for common types using reflection.
If needed you may extend this class to handle your own custome types.
text
- Text representation of type should not be null or emptyThrowable
- DOCUMENT ME!IOException
- If text could not be parsedDataSourceException
- DOCUMENT ME!Copyright © 1996–2019 Geotools. All rights reserved.