de.ispsoft.jaxme.jaxb
Class ValidatorImpl

java.lang.Object
  extended byde.ispsoft.jaxme.jaxb.JMManagerFactoryAttachable
      extended byde.ispsoft.jaxme.jaxb.ValidatorImpl
All Implemented Interfaces:
Validator

public class ValidatorImpl
extends JMManagerFactoryAttachable
implements Validator

JaxMe's implementation of a Validator.

Version:
$Id: ValidatorImpl.java,v 1.3 2003/05/21 03:30:18 joe Exp $
Author:
Jochen Wiedmann

Field Summary
 
Fields inherited from class de.ispsoft.jaxme.jaxb.JMManagerFactoryAttachable
BUILTIN_DATE_FORMAT, BUILTIN_DATETIME_FORMAT, BUILTIN_ENCODING, BUILTIN_TIME_FORMAT
 
Constructor Summary
ValidatorImpl()
          Constructor for ValidatorImpl.
 
Method Summary
 ValidationEventHandler getEventHandler()
          Return the current event handler or the default event handler if one hasn't been set.
 void setEventHandler(ValidationEventHandler pHandler)
          Allow an application to register a validation event handler.
 boolean validate(java.lang.Object pObject)
          Validate the Java content tree starting at subrootObj.
 boolean validateRoot(java.lang.Object pObject)
          Validate the Java content tree rooted at rootObj.
 
Methods inherited from class de.ispsoft.jaxme.jaxb.JMManagerFactoryAttachable
getDateFormat, getDateFormat, getDateFormatForPattern, getDateTimeFormat, getDateTimeFormat, getEncoding, getFactory, getLocale, getMessageFormat, getNumberFormat, getPrivateProperty, getProperty, getResourceBundle, getResourceValue, getTimeFormat, getTimeFormat, setDateFormat, setDateTimeFormat, setEncoding, setFactory, setLocale, setPrivateProperty, setProperty, setResourceBundle, setTimeFormat
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValidatorImpl

public ValidatorImpl()
Constructor for ValidatorImpl.

Method Detail

setEventHandler

public void setEventHandler(ValidationEventHandler pHandler)
Description copied from interface: Validator
Allow an application to register a validation event handler.

The validation event handler will be called by the JAXB Provider if any validation errors are encountered during calls to validate. If the client application does not register a validation event handler before invoking the validate method, then validation events will be handled by the default event handler which will terminate the validate operation after the first error or fatal error is encountered.

Specified by:
setEventHandler in interface Validator
Parameters:
pHandler - the validation event handler

getEventHandler

public ValidationEventHandler getEventHandler()
Description copied from interface: Validator
Return the current event handler or the default event handler if one hasn't been set.

Specified by:
getEventHandler in interface Validator
Returns:
the current ValidationEventHandler or the default event handler if it hasn't been set

validate

public boolean validate(java.lang.Object pObject)
Description copied from interface: Validator
Validate the Java content tree starting at subrootObj.

Client applications can use this method to validate Java content trees on-demand at runtime. This method can be used to validate any arbitrary subtree of the Java content tree. Global constraint checking will not be performed as part of this operation (i.e. ID/IDREF constraints).

TODO: what happens if the client passes a random java.lang.Object into this method? Throw a runtime exception?

Specified by:
validate in interface Validator
Parameters:
pObject - the obj to begin validation at
Returns:
true if the subtree rooted at subrootObj is valid, false otherwise

validateRoot

public boolean validateRoot(java.lang.Object pObject)
Description copied from interface: Validator
Validate the Java content tree rooted at rootObj.

Client applications can use this method to validate Java content trees on-demand at runtime. This method is used to validate an entire Java content tree. Global constraint checking will be performed as part of this operation (i.e. ID/IDREF constraints).

TODO: what happens if the client passes a random java.lang.Object into this method? Throw a runtime exception?

Specified by:
validateRoot in interface Validator
Parameters:
pObject - the root obj to begin validation at
Returns:
true if the tree rooted at rootObj is valid, false otherwise