|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
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)
Restores a file parameter from an XML representation. |
|
FileParameter(String name,
String comment,
String mime,
boolean required)
Creates a file parameter. |
|
FileParameter(String name,
String comment,
String mime,
boolean required,
ParameterValidator validator)
Constructs a file parameter. |
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()
|
protected void |
fromXML(StringBuffer representation)
Parses a Parameter from an 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. |
boolean |
isAtomic()
Returns true if the parameter is of an atomic data type |
boolean |
isRequired()
Returns true if the parameter is required, false otherwise |
boolean |
isSet()
Returns true if the parameter was set by the user. |
void |
reset()
Resets the file parameter 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. |
StringBuffer |
toXML()
This method returns an XML-representation 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
buf
- the XML representation
NonParsableException
- if the XML code could not be parsed, an Exception is thrownpublic FileParameter(String name, String comment, String mime, boolean required)
name
- the name of the parametercomment
- a comment on the parametermime
- the mime type of allowed filesrequired
- true if the parameter is required to continuepublic FileParameter(String name, String comment, String mime, boolean required, ParameterValidator validator)
name
- the name of the parametercomment
- a comment on the parametermime
- the mime-type of allowed filesrequired
- true if parameter 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
getName
in class Parameter
public boolean isAtomic()
Parameter
isAtomic
in class Parameter
public DataType getDatatype()
Parameter
getDatatype
in class Parameter
public String getComment()
Parameter
getComment
in class Parameter
public boolean isRequired()
Parameter
true
if the parameter is required, false
otherwise
isRequired
in class Parameter
public void reset()
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
public void setDefault(Object defaultValue) throws SimpleParameter.IllegalValueException
Parameter
defaultValue
setDefault
in class Parameter
defaultValue
- the default value
SimpleParameter.IllegalValueException
public void simplify()
Parameter
CollectionParameter
that are not
selected.
simplify
in class Parameter
public void setValue(Object value) throws SimpleParameter.IllegalValueException
Parameter
value
.
setValue
in class Parameter
value
- the new value
SimpleParameter.IllegalValueException
- if the specified value is not valid for this Parameter
an IllegalValueException
is thrownpublic Object getValue()
Parameter
Parameter
getValue
in class Parameter
public boolean hasDefaultOrIsSet()
Parameter
hasDefaultOrIsSet
in class Parameter
public boolean isSet()
Parameter
isSet
in class Parameter
public StringBuffer toXML()
Storable
toXML
in interface Storable
toXML
in class Parameter
protected void fromXML(StringBuffer representation) throws NonParsableException
Parameter
Parameter
from an XML-representation as returned by Parameter.toXML()
.
fromXML
in class Parameter
representation
- the XML-representation
NonParsableException
- is thrown if the XML-code could not be parsedpublic String getAcceptedMimeType()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |