public class OptionsParameter extends Object
| Constructor and Description |
|---|
OptionsParameter() |
| Modifier and Type | Method and Description |
|---|---|
void |
addAllowedOption(String name,
SequenceType type)
Register a permitted option keyword, and the associated type of value, without defining
a default value
|
void |
addAllowedOption(String name,
SequenceType type,
Sequence defaultValue)
Register a permitted option keyword, and the associated type of value, with a default value
|
void |
addRequiredOption(String name,
SequenceType type)
Register a required option keyword, and the associated type of value, where omitting
the value is an error
|
Map<String,Sequence> |
getDefaultOptions()
Get a Java map containing the default values of registered options
|
String |
getErrorCodeForAbsentValue() |
boolean |
isAllowCastFromString() |
Map<String,Sequence> |
processSuppliedOptions(MapItem supplied,
XPathContext context)
Process an XPath map containing the supplied values.
|
void |
setAllowCastFromString(boolean allowCastFromString) |
void |
setAllowedValues(String name,
String errorCode,
String... values)
Enumerate the permitted values for an option keyword
|
void |
setErrorCodeForAbsentValue(String errorCodeForAbsentValue) |
public void addAllowedOption(String name, SequenceType type)
name - the option keywordtype - the required typepublic void addRequiredOption(String name, SequenceType type)
name - the option keywordtype - the required typepublic void addAllowedOption(String name, SequenceType type, Sequence defaultValue)
name - the option keywordtype - the required typedefaultValue - the default value if the option is not specified; or null
if no default is definedpublic void setAllowedValues(String name, String errorCode, String... values)
name - the option keyworderrorCode - the error to be reported if the supplied value is not one of those permittedvalues - the permitted valuespublic Map<String,Sequence> processSuppliedOptions(MapItem supplied, XPathContext context) throws XPathException
supplied - the supplied options as an XPath map objectcontext - the dynamic evaluation contextXPathException - if any supplied options are invalidpublic Map<String,Sequence> getDefaultOptions()
public String getErrorCodeForAbsentValue()
public void setErrorCodeForAbsentValue(String errorCodeForAbsentValue)
public boolean isAllowCastFromString()
public void setAllowCastFromString(boolean allowCastFromString)
Copyright (c) 2004-2017 Saxonica Limited. All rights reserved.