|
||||||||||
| 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 thrown
public 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 continue
public 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 file| Method Detail |
|---|
public FileParameter clone()
throws CloneNotSupportedException
clone in class ParameterCloneNotSupportedExceptionpublic String getName()
Parameter
getName in class Parameterpublic boolean isAtomic()
Parameter
isAtomic in class Parameterpublic DataType getDatatype()
Parameter
getDatatype in class Parameterpublic String getComment()
Parameter
getComment in class Parameterpublic boolean isRequired()
Parametertrue if the parameter is required, false otherwise
isRequired in class Parameterpublic void reset()
reset in class Parameterpublic FileParameter.FileRepresentation getFileContents()
public String getErrorMessage()
Parameter
getErrorMessage in class Parameterpublic boolean checkValue(Object value)
Parameter
checkValue in class Parametervalue - the value to be checked
public void setDefault(Object defaultValue)
throws SimpleParameter.IllegalValueException
ParameterdefaultValue
setDefault in class ParameterdefaultValue - the default value
SimpleParameter.IllegalValueExceptionpublic void simplify()
ParameterCollectionParameter that are not
selected.
simplify in class Parameter
public void setValue(Object value)
throws SimpleParameter.IllegalValueException
Parametervalue.
setValue in class Parametervalue - the new value
SimpleParameter.IllegalValueException - if the specified value is not valid for this Parameter an IllegalValueException is thrownpublic Object getValue()
ParameterParameter
getValue in class Parameterpublic boolean hasDefaultOrIsSet()
Parameter
hasDefaultOrIsSet in class Parameterpublic boolean isSet()
Parameter
isSet in class Parameterpublic StringBuffer toXML()
Storable
toXML in interface StorabletoXML in class Parameter
protected void fromXML(StringBuffer representation)
throws NonParsableException
ParameterParameter from an XML-representation as returned by Parameter.toXML().
fromXML in class Parameterrepresentation - 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 | |||||||||