|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.jstacs.parameters.validation.StorableValidator
public class StorableValidator
Class for a validator that validates instances and XML-representations for the correct class types (e.g. AbstractModel
Constructor Summary | |
---|---|
StorableValidator(Class<? extends Storable> clazz)
Creates a new ObjectValidator for a subclass of Storable . |
|
StorableValidator(Class<? extends Storable> clazz,
boolean trained)
Creates a new ObjectValidator for a subclass of AbstractModel
or AbstractClassifier . |
|
StorableValidator(StringBuffer buf)
Constructs an ObjectValidator from its XML-representation |
Method Summary | |
---|---|
boolean |
checkValue(Object value)
Checks the value of value . |
StorableValidator |
clone()
This method returns a deep copy of the current instance. |
void |
fromXML(StringBuffer representation)
Parses a StorableValidator from the XML-representation
as returned by toXML() . |
String |
getErrorMessage()
Returns the error message if checkValue() returned false. |
StringBuffer |
toXML()
This method returns an XML-representation of an instance of the implementing class. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public StorableValidator(Class<? extends Storable> clazz, boolean trained) throws Exception
ObjectValidator
for a subclass of AbstractModel
or AbstractClassifier
. This constructor may not be used on other subclasses of Storable
clazz
- the classtrained
- true if the model or classifier must be trained
Exception
- an exception is thrown if clazz
is not of expected typepublic StorableValidator(Class<? extends Storable> clazz) throws Exception
ObjectValidator
for a subclass of Storable
.
clazz
- the class
Exception
- an exception is thrown if clazz
is not of expected typepublic StorableValidator(StringBuffer buf) throws NonParsableException
ObjectValidator
from its XML-representation
buf
- the XML-representation
NonParsableException
- a NonParsableException
is thrown if buf
could not be parsedMethod Detail |
---|
public StorableValidator clone() throws CloneNotSupportedException
ParameterValidator
clone
in interface ParameterValidator
clone
in class Object
CloneNotSupportedException
- if the ParameterValidator could not be clonedCloneable
public boolean checkValue(Object value)
value
. Allowed types of value
are AbstractModel
,
AbstractClassifier
, FileRepresentation
, String
, and StringBuffer
.
In all cases where an XML-representation is given as value
, it must be surrounded by <object>-tags and
these tags must contain a <className>-element that contains the name of the class of the represented instance.
checkValue
in interface ParameterValidator
value
- the value to be checked.
public String getErrorMessage()
ParameterValidator
checkValue()
returned false.
getErrorMessage
in interface ParameterValidator
public StringBuffer toXML()
Storable
toXML
in interface Storable
public void fromXML(StringBuffer representation) throws NonParsableException
StorableValidator
from the XML-representation
as returned by toXML()
.
representation
- the XML-representation
NonParsableException
- thrown if the XML-code could not be parsed
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |