|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
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. AbstractTrainableStatisticalModel
).
Constructor Summary | |
---|---|
StorableValidator(Class<? extends Storable> clazz)
Creates a new StorableValidator for a subclass of
Storable . |
|
StorableValidator(Class<? extends Storable> clazz,
boolean trained)
Creates a new StorableValidator for a subclass of
AbstractTrainableStatisticalModel or AbstractClassifier . |
|
StorableValidator(StringBuffer buf)
The standard constructor for the interface Storable . |
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 ParameterValidator.checkValue(Object) returned false. |
StringBuffer |
toXML()
This method returns an XML representation as StringBuffer 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
StorableValidator
for a subclass of
AbstractTrainableStatisticalModel
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
- if clazz
is not of the expected typepublic StorableValidator(Class<? extends Storable> clazz) throws Exception
StorableValidator
for a subclass of
Storable
.
clazz
- the class
Exception
- if clazz
is not of the expected typepublic StorableValidator(StringBuffer buf) throws NonParsableException
Storable
.
Constructs an StorableValidator
from its XML representation.
buf
- the XML representation as StringBuffer
NonParsableException
- 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 AbstractTrainableStatisticalModel
, AbstractClassifier
,
FileParameter.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 Object
to be checked
true
if value
is valid and
false
otherwisepublic String getErrorMessage()
ParameterValidator
ParameterValidator.checkValue(Object)
returned false.
getErrorMessage
in interface ParameterValidator
public StringBuffer toXML()
Storable
StringBuffer
of an
instance of the implementing class.
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
- if the XML code could not be parsed
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |