Package org.geotools.api.data
Class DataAccessFactory.Param
- All Implemented Interfaces:
Parameter
- Direct Known Subclasses:
WFSDataAccessFactory.WFSFactoryParam
- Enclosing interface:
- DataAccessFactory
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
ConstructorsConstructorDescriptionProvides support for text representationsProvides support for text representations.Provides support for text representationsProvides support for text representationsProvides 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
Modifier and TypeMethodDescriptionHandle text in a sensible manner.Lookup Param in a user supplied map.Provides support for text representationsConvert value to text representation for this ParametertoString()
key=Type descriptionMethods inherited from class Parameter
equals, getDefaultValue, getDescription, getLevel, getMaxOccurs, getMinOccurs, getName, getTitle, getType, hashCode, isDeprecated, isPassword, isRequired
-
Constructor Details
-
Param
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
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
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
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
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
-
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 Details
-
lookUp
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
Convert value to text representation for this Parameter -
handle
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
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
-
toString
key=Type description
-