public class OptionsParameter
extends java.lang.Object
Constructor and Description |
---|
OptionsParameter() |
Modifier and Type | Method and Description |
---|---|
void |
addAllowedOption(java.lang.String name,
SequenceType type)
Register a permitted option keyword, and the associated type of value, without defining
a default value
|
void |
addAllowedOption(java.lang.String name,
SequenceType type,
Sequence<?> defaultValue)
Register a permitted option keyword, and the associated type of value, with a default value
|
void |
addRequiredOption(java.lang.String name,
SequenceType type)
Register a required option keyword, and the associated type of value, where omitting
the value is an error
|
java.util.Map<java.lang.String,Sequence<?>> |
getDefaultOptions()
Get a Java map containing the default values of registered options
|
java.lang.String |
getErrorCodeForAbsentValue()
Get the error code to be used when a required option is not supplied
|
boolean |
isAllowCastFromString()
Ask whether it is is permissible to supply the value as a string, which is cast to the
required type, rather than supplying the required type directly.
|
java.util.Map<java.lang.String,Sequence<?>> |
processSuppliedOptions(MapItem supplied,
XPathContext context)
Process an XPath map containing the supplied values.
|
void |
setAllowCastFromString(boolean allowCastFromString)
Say whether it is is permissible to supply the value as a string, which is cast to the
required type, rather than supplying the required type directly.
|
void |
setAllowedValues(java.lang.String name,
java.lang.String errorCode,
java.lang.String... values)
Enumerate the permitted values for an option keyword
|
void |
setErrorCodeForAbsentValue(java.lang.String errorCodeForAbsentValue)
Set the error code to be used when a required option is not supplied
|
public void addAllowedOption(java.lang.String name, SequenceType type)
name
- the option keywordtype
- the required typepublic void addRequiredOption(java.lang.String name, SequenceType type)
name
- the option keywordtype
- the required typepublic void addAllowedOption(java.lang.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(java.lang.String name, java.lang.String errorCode, java.lang.String... values)
name
- the option keyworderrorCode
- the error to be reported if the supplied value is not one of those permittedvalues
- the permitted valuespublic java.util.Map<java.lang.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 java.util.Map<java.lang.String,Sequence<?>> getDefaultOptions()
public java.lang.String getErrorCodeForAbsentValue()
public void setErrorCodeForAbsentValue(java.lang.String errorCodeForAbsentValue)
errorCodeForAbsentValue
- the local part of the error code to be usedpublic boolean isAllowCastFromString()
public void setAllowCastFromString(boolean allowCastFromString)
allowCastFromString
- true if is is permitted to supply the value as a stringCopyright (c) 2004-2020 Saxonica Limited. All rights reserved.