|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.ac.starlink.task.Parameter<String[]>
uk.ac.starlink.ttools.task.WordsParameter
public class WordsParameter
Parameter which can split its value up into an array of words. Words are generally delimited by whitespace, but can be quoted using single or double quotes as in the shell. You can specify the required number of words.
Field Summary |
---|
Fields inherited from class uk.ac.starlink.task.Parameter |
---|
BY_NAME |
Constructor Summary | |
---|---|
WordsParameter(String name)
Constructor. |
Method Summary | |
---|---|
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. |
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(String wordUsage)
Configures the usage of this parameter from usages for given words. |
String[] |
stringToObject(uk.ac.starlink.task.Environment env,
String sval)
|
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. |
Methods inherited from class uk.ac.starlink.task.Parameter |
---|
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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public WordsParameter(String name)
name
- parameter nameMethod Detail |
---|
public 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(String wordUsage)
wordUsage
- per-word usagepublic String[] wordsValue(uk.ac.starlink.task.Environment env) throws uk.ac.starlink.task.TaskException
env
- execution environment
uk.ac.starlink.task.TaskException
public 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 environment
uk.ac.starlink.task.TaskException
public String[] stringToObject(uk.ac.starlink.task.Environment env, String sval) throws uk.ac.starlink.task.TaskException
stringToObject
in class uk.ac.starlink.task.Parameter<String[]>
uk.ac.starlink.task.TaskException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |