public class WordsParameter
extends uk.ac.starlink.task.Parameter<java.lang.String[]>
Constructor and Description |
---|
WordsParameter(java.lang.String name)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
getRequiredWordCount()
Returns the number of words required from this parameter.
|
WordParser |
getWordParser()
Returns the parser which is being used to validate and to parse each
word in the supplied value string.
|
java.lang.Object[] |
parsedWordsValue(uk.ac.starlink.task.Environment env)
Returns the value of this parameter as an array of objects which have
resulted from the parsing of the
wordsValue(uk.ac.starlink.task.Environment) using the
currently installed WordParser . |
void |
setRequiredWordCount(int nWords)
Sets the number of words required from this parameter.
|
void |
setWordParser(WordParser parser)
Sets a parser which will be used to validate and to parse each
word in the supplied value string.
|
void |
setWordUsage(java.lang.String wordUsage)
Configures the usage of this parameter from usages for given words.
|
java.lang.String[] |
stringToObject(uk.ac.starlink.task.Environment env,
java.lang.String sval) |
java.lang.String[] |
wordsValue(uk.ac.starlink.task.Environment env)
If the required word count value of this parameter is non-negative,
then the return value is guaranteed to contain that number of elements.
|
clearValue, getDescription, getName, getPosition, getPreferExplicit, getPrompt, getStringDefault, getUsage, getValueClass, isNullPermitted, objectToString, objectValue, setDescription, setDescription, setName, setNullPermitted, setPosition, setPreferExplicit, setPrompt, setStringDefault, setUsage, setValue, setValueFromObject, setValueFromString, stringValue, toArray, toString
public WordsParameter(java.lang.String name)
name
- parameter namepublic void setRequiredWordCount(int nWords)
nWords
- required number of wordspublic int getRequiredWordCount()
public void setWordParser(WordParser parser)
parser
- word parser to installpublic WordParser getWordParser()
public void setWordUsage(java.lang.String wordUsage)
wordUsage
- per-word usagepublic java.lang.String[] wordsValue(uk.ac.starlink.task.Environment env) throws uk.ac.starlink.task.TaskException
env
- execution environmentuk.ac.starlink.task.TaskException
public java.lang.Object[] parsedWordsValue(uk.ac.starlink.task.Environment env) throws uk.ac.starlink.task.TaskException
wordsValue(uk.ac.starlink.task.Environment)
using the
currently installed WordParser
. If no word parser is
installed, this will have the same contents (Strings) as the words.
If the required word count value of this parameter is non-negative,
then the return value is guaranteed to contain that number of elements.env
- execution environmentuk.ac.starlink.task.TaskException
public java.lang.String[] stringToObject(uk.ac.starlink.task.Environment env, java.lang.String sval) throws uk.ac.starlink.task.TaskException
stringToObject
in class uk.ac.starlink.task.Parameter<java.lang.String[]>
uk.ac.starlink.task.TaskException
Copyright © 2017 Central Laboratory of the Research Councils. All Rights Reserved.