public class RegExpValidator extends Object implements ParameterValidator, GalaxyConvertible
ParameterValidator
that checks if a given input String
matches a regular expression.Constructor and Description |
---|
RegExpValidator(String regExp)
Creates a validator for the given regular expression.
|
RegExpValidator(StringBuffer xml)
Creates a
RegExpValidator from its XML representation. |
Modifier and Type | Method and Description |
---|---|
boolean |
checkValue(Object value)
Returns
true if the value is valid and false
otherwise. |
RegExpValidator |
clone()
This method returns a deep copy of the current instance.
|
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, boolean)
and sets the values of the Parameter or ParameterSet accordingly. |
String |
getErrorMessage()
Returns the error message if
ParameterValidator.checkValue(Object) returned false. |
void |
toGalaxy(String namePrefix,
String configPrefix,
int depth,
StringBuffer descBuffer,
StringBuffer configBuffer,
boolean addLine)
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. |
public RegExpValidator(String regExp)
regExp
- the regular expressionPattern
public RegExpValidator(StringBuffer xml) throws NonParsableException
RegExpValidator
from its XML representation.xml
- the XML representationNonParsableException
- if the XML representation could not be parsedpublic StringBuffer toXML()
Storable
StringBuffer
of an
instance of the implementing class.public boolean checkValue(Object value)
ParameterValidator
true
if the value is valid and false
otherwise.checkValue
in interface ParameterValidator
value
- the Object
to be checkedvalue
is validpublic String getErrorMessage()
ParameterValidator
ParameterValidator.checkValue(Object)
returned false.getErrorMessage
in interface ParameterValidator
public RegExpValidator clone() throws CloneNotSupportedException
ParameterValidator
clone
in interface ParameterValidator
clone
in class Object
CloneNotSupportedException
- if the ParameterValidator
could not be clonedCloneable
public void toGalaxy(String namePrefix, String configPrefix, int depth, StringBuffer descBuffer, StringBuffer configBuffer, boolean addLine) throws Exception
GalaxyConvertible
descBuffer
and variable configuration and appends it to configBuffer
. The variable configuration
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 lineaddLine
- if true, a line is added before the title of a parameterException
- if the conversion failspublic void fromGalaxy(String namePrefix, StringBuffer command) throws Exception
GalaxyConvertible
command
in the format defined by configBuffer
of GalaxyConvertible.toGalaxy(String, String, int, StringBuffer, StringBuffer, boolean)
and sets the values of the Parameter
or ParameterSet
accordingly.fromGalaxy
in interface GalaxyConvertible
namePrefix
- the prefix of the variable namecommand
- the command stringException
- if the command string could not be parsed