|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.jstacs.parameters.Parameter
de.jstacs.parameters.FileParameter
public class FileParameter
Class for a Parameter
that represents a local file.
Nested Class Summary | |
---|---|
static class |
FileParameter.FileRepresentation
Class that represents a file. |
Field Summary |
---|
Fields inherited from class de.jstacs.parameters.Parameter |
---|
neededReference, neededReferenceId, parent |
Constructor Summary | |
---|---|
FileParameter(StringBuffer buf)
The standard constructor for the interface Storable . |
|
FileParameter(String name,
String comment,
String mime,
boolean required)
Creates a FileParameter . |
|
FileParameter(String name,
String comment,
String mime,
boolean required,
ParameterValidator validator)
Constructs a FileParameter . |
Method Summary | |
---|---|
boolean |
checkValue(Object value)
Checks the value for correctness, e.g. for numerical parameters this might be checking if the value is within specified bounds. |
FileParameter |
clone()
|
void |
fromGalaxy(String namePrefix,
StringBuffer command)
Parses the contents of command in the format defined by configBuffer of GalaxyConvertible.toGalaxy(String, String, int, StringBuffer, StringBuffer)
and sets the values of the Parameter or ParameterSet accordingly. |
protected void |
fromXML(StringBuffer representation)
Parses a Parameter from a XML representation as returned by
Parameter.toXML() . |
String |
getAcceptedMimeType()
Returns the MIME-type of the allowed files. |
String |
getComment()
Returns a comment on this Parameter that tells something about
useful values, domains, usage of this parameter, etc. |
DataType |
getDatatype()
Returns the data type of the Parameter . |
String |
getErrorMessage()
If a value could not be set successfully this method returns the corresponding error message. |
FileParameter.FileRepresentation |
getFileContents()
Returns the content of the file. |
String |
getName()
Returns the name of the Parameter . |
Object |
getValue()
Returns the current value of this Parameter . |
boolean |
hasDefaultOrIsSet()
Returns true if the parameter either has a default value or
the value was set by the user, false otherwise. |
boolean |
isAtomic()
Returns true if the parameter is of an atomic data type,
false otherwise. |
boolean |
isRequired()
Returns true if the Parameter is required,
false otherwise. |
boolean |
isSet()
Returns true if the parameter was set by the user,
false otherwise. |
void |
reset()
Resets the FileParameter to its original state. |
void |
setDefault(Object defaultValue)
Sets the default value of the Parameter to
defaultValue . |
void |
setValue(Object value)
Sets the value of this Parameter to value . |
void |
simplify()
Simplifies the Parameter and its contents to the relevant
information. |
void |
toGalaxy(String namePrefix,
String configPrefix,
int depth,
StringBuffer descBuffer,
StringBuffer configBuffer)
Creates an Galaxy XML-representation of the parameters and appends it to descBuffer
and variable configuration and appends it to configBuffer . |
StringBuffer |
toXML()
This method returns an XML representation as StringBuffer of an
instance of the implementing class. |
Methods inherited from class de.jstacs.parameters.Parameter |
---|
getId, getNeededReference, getNeededReferenceId, getParent, setNeededReference, setParent |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FileParameter(StringBuffer buf) throws NonParsableException
Storable
.
Restores a FileParameter
from an XML representation.
buf
- the XML representation as StringBuffer
NonParsableException
- if the XML code could not be parsedfromXML(StringBuffer)
public FileParameter(String name, String comment, String mime, boolean required)
FileParameter
.
name
- the name of the parametercomment
- a comment on the parametermime
- the MIME-type of allowed filesrequired
- true
if this FileParameter
is required to
continue, false
otherwisepublic FileParameter(String name, String comment, String mime, boolean required, ParameterValidator validator)
FileParameter
.
name
- the name of the parametercomment
- a comment on the parametermime
- the MIME-type of allowed filesrequired
- true
if this FileParameter
is requiredvalidator
- a validator that validates e.g. the contents of the fileMethod Detail |
---|
public FileParameter clone() throws CloneNotSupportedException
clone
in class Parameter
CloneNotSupportedException
public String getName()
Parameter
Parameter
.
getName
in class Parameter
Parameter
public boolean isAtomic()
Parameter
true
if the parameter is of an atomic data type,
false
otherwise.
isAtomic
in class Parameter
true
if the parameter is atomic, false
otherwisepublic DataType getDatatype()
Parameter
Parameter
.
getDatatype
in class Parameter
Parameter
public String getComment()
Parameter
Parameter
that tells something about
useful values, domains, usage of this parameter, etc.
getComment
in class Parameter
public boolean isRequired()
Parameter
true
if the Parameter
is required,
false
otherwise.
isRequired
in class Parameter
true
if the Parameter
is required,
false
otherwisepublic void reset()
FileParameter
to its original state.
reset
in class Parameter
public FileParameter.FileRepresentation getFileContents()
public String getErrorMessage()
Parameter
getErrorMessage
in class Parameter
public boolean checkValue(Object value)
Parameter
checkValue
in class Parameter
value
- the value to be checked
true
if the value is valid, false
otherwisepublic void setDefault(Object defaultValue) throws SimpleParameter.IllegalValueException
Parameter
Parameter
to
defaultValue
.
setDefault
in class Parameter
defaultValue
- the default value
SimpleParameter.IllegalValueException
public void simplify()
Parameter
Parameter
and its contents to the relevant
information. This could be e.g. to reset the contents of those values of
a CollectionParameter
that are not selected.
simplify
in class Parameter
public void setValue(Object value) throws SimpleParameter.IllegalValueException
Parameter
Parameter
to value
.
setValue
in class Parameter
value
- the new value of the Parameter
SimpleParameter.IllegalValueException
- if the specified value is not valid for this
Parameter
public Object getValue()
Parameter
Parameter
.
getValue
in class Parameter
Parameter
public boolean hasDefaultOrIsSet()
Parameter
true
if the parameter either has a default value or
the value was set by the user, false
otherwise.
hasDefaultOrIsSet
in class Parameter
true
if value has a default value or was set,
false
otherwisepublic boolean isSet()
Parameter
true
if the parameter was set by the user,
false
otherwise.
isSet
in class Parameter
true
if the parameter was set, false
otherwisepublic StringBuffer toXML()
Storable
StringBuffer
of an
instance of the implementing class.
toXML
in interface Storable
toXML
in class Parameter
protected void fromXML(StringBuffer representation) throws NonParsableException
Parameter
Parameter
from a XML representation as returned by
Parameter.toXML()
.
fromXML
in class Parameter
representation
- the XML representation as StringBuffer
NonParsableException
- if the XML code could not be parsedParameter.toXML()
public String getAcceptedMimeType()
public void toGalaxy(String namePrefix, String configPrefix, int depth, StringBuffer descBuffer, StringBuffer configBuffer)
GalaxyConvertible
descBuffer
and variable configuration and appends it to configBuffer
. The variable configuation
is also used to parse user-supplied values returned by Galaxy.
toGalaxy
in interface GalaxyConvertible
namePrefix
- the prefix of the variable name used in GalaxyconfigPrefix
- the prefix for conditionalsdepth
- the depth in the parameter hierarchy, used for graphical representation of nestingdescBuffer
- the buffer for the parameter descriptionconfigBuffer
- the buffer for the configuration linepublic void fromGalaxy(String namePrefix, StringBuffer command) throws Exception
GalaxyConvertible
command
in the format defined by configBuffer
of GalaxyConvertible.toGalaxy(String, String, int, StringBuffer, StringBuffer)
and sets the values of the Parameter
or ParameterSet
accordingly.
fromGalaxy
in interface GalaxyConvertible
namePrefix
- the prefix of the variable namecommand
- the command string
Exception
- if the command string could not be parsed
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |