Oracle Fusion Middleware Java API Reference for Oracle ADF Model
11g Release 1 (11.1.1)

E10653-04

oracle.jbo.server.rules
Class JboMethodValidator

java.lang.Object
  extended by oracle.jbo.rules.AbstractValidator
      extended by oracle.jbo.server.rules.JboBaseValidator
          extended by oracle.jbo.server.rules.JboMethodValidator
All Implemented Interfaces:
java.util.EventListener, ValidatorConstants, JbiValidator, VetoableChangeListener, VariableManagerOwner, VariableManagerOwnerBase

public class JboMethodValidator
extends JboBaseValidator
implements JbiValidator

A validator that tests values by passing them to a validation method.

The validation method must be public, take a single Object parameter and return Boolean.

Since:
Jdeveloper 3.0

Field Summary
 
Fields inherited from class oracle.jbo.server.rules.JboBaseValidator
mBindingStyle, mValidatingAttr, mValidatingAttrName
 
Fields inherited from class oracle.jbo.rules.AbstractValidator
mbInverse, mErrorMessageClass, mMsgExpr, mMsgId, mMsgIds, mResourceBundleId, mTriggeringAttributeNames, mTriggeringAttributes
 
Fields inherited from interface oracle.jbo.rules.ValidatorConstants
ATTR, ATTR_STR, BETWEEN, EO, EO_STR, EQUALTO, EXPR, EXPR_STR, GREATERTHAN, GREATERTHANEQUALTO, JBO, JBO_STR, LESSTHAN, LESSTHANEQUALTO, LITERAL, LITERAL_STR, MANDATORY_STR, mCompOperTypeVals, mRhsTypeVals, mSeverityVals, PNAME_CompareLength, PNAME_CompareType, PNAME_CompareValue, PNAME_DataType, PNAME_ErrorMessageExpressions, PNAME_ErrorMessageId, PNAME_ErrorMessageIds, PNAME_Exposed, PNAME_ForPersonalization, PNAME_Inverse, PNAME_Name, PNAME_OnAttribute, PNAME_OnAttributes, PNAME_OnCondition, PNAME_OperandType, PNAME_Severity, PNAME_Subtype, PNAME_TransactionLevel, PNAME_TransientExpression, PNAME_ValidationBeanClass, PNAME_ValName, PNAME_xmlns, PRECISION_SCALE_STR, SEVERITY_ERROR, SEVERITY_RECOVERABLE_ERROR, SEVERITY_VETOABLE_WARNING, SEVERITY_WARNING, SQL, SQL_STR, VALIDATION_XMLNS, VALIDATOR_MSG_ID_PREFIX, VO, VO_STR, VO_USAGE, VO_USAGE_STR
 
Constructor Summary
JboMethodValidator()
          Creates a validator without assigning its validation method.
JboMethodValidator(java.lang.String methodName, java.lang.Class entityClz, java.lang.Class clz)
          Creates a validator given the name of the validation method.
 
Method Summary
 java.lang.String getDescription()
          Gets the textul description of this validator.
 java.lang.reflect.Method getMethod()
          Gets the method invoked by this validator.
 java.lang.String getMethodName()
          Gets the name of the method invoked by this validator.
 void loadXMLContents(DefElement elem)
           
 void setDescription(java.lang.String description)
          Sets the textul description of this validator.
 void setMethodName(java.lang.String mthName)
          Sets the name of the method invoked by this validator.
 void setObjectMethod(java.lang.Class entityClz, java.lang.Class attrClaz)
          This implementation finds the given method in the given object and stores the Method reference for invocation by validateValue.
 java.lang.String toString()
          Internal: For debugging purposes only.
 boolean validateValue(java.lang.Object value)
          Validate an object by passing it to the validation method.
 void vetoableChange(PropertyChangeEvent evObj)
          Invokes validateValue() on a value contained in a constrained property.
 
Methods inherited from class oracle.jbo.server.rules.JboBaseValidator
extractValueToValidate, getBindingStyle, initialize, raiseException, resolve, setBindingStyle, setNewValue, setValidatingAttribute, setValidatingAttribute
 
Methods inherited from class oracle.jbo.rules.AbstractValidator
applyValidatorPersonalization, clone, convertToJava, copyErrorMsgInfo, createException, createExprValueSupplier, ensureVariableManager, getErrorMessageClass, getErrorMsgExpressions, getErrorMsgId, getFullName, getInverse, getMessageBundleClass, getName, getOnCondition, getOwner, getResourceBundleDef, getResourceBundleId, getSeverity, getTriggeringAttributeDefs, getTriggeringAttributeNames, getValidatingAttributeName, getValidatorSubType, getVariableManager, hasErrorMsg, hasValidationCondition, hasVariables, initErrMsgParms, initTriggeringAttributeDefs, initValidatorProperties, isDirty, isMovedToAttrLevel, isNew, isTransactionLevel, isTransactionLevel, isValidatable, loadVariables, parseSeverityStr, prepareException, raiseException, raiseException, readStringArrayList, readUserObject, readUserObject, readUserObjectTrim, readUserObjectTrim, readUserStringElementsMap, setDefaultDescription, setDirty, setErrorMessageClass, setErrorMsgExpressions, setErrorMsgId, setErrorMsgIds, setInverse, setNew, setOnCondition, setResourceBundleDef, setResourceBundleId, setSeverity, setTransactionLevel, setTriggeringAttributeNames, setValidatingAttributeName, writeChildren, writeContents
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JboMethodValidator

public JboMethodValidator()
Creates a validator without assigning its validation method.


JboMethodValidator

public JboMethodValidator(java.lang.String methodName,
                          java.lang.Class entityClz,
                          java.lang.Class clz)
Creates a validator given the name of the validation method.

Parameters:
methodName - the name of a Java method. The method must be public, take a single Object parameter and return Boolean.
Method Detail

vetoableChange

public void vetoableChange(PropertyChangeEvent evObj)
Invokes validateValue() on a value contained in a constrained property.

Specified by:
vetoableChange in interface VetoableChangeListener
Overrides:
vetoableChange in class JboBaseValidator
Parameters:
evObj - a PropertyChangeEvent() containing a property to be validated.
Throws:
JboException - if validation fails.

validateValue

public boolean validateValue(java.lang.Object value)
                      throws JboException
Validate an object by passing it to the validation method.

Specified by:
validateValue in interface JbiValidator
Specified by:
validateValue in class JboBaseValidator
Parameters:
value - the object to be validated.
Returns:
false if the validation method cannot be found or if the validation method throws an exception that is not a instance of JboException. Otherwise, pass on the boolean value returned by the validation method.
Throws:
JboException - if the validation method throws an instance of JboException.

setMethodName

public void setMethodName(java.lang.String mthName)
Sets the name of the method invoked by this validator.

Parameters:
mthName - the name of a Java method. The method must be public, take a single Object parameter and return Boolean.

setObjectMethod

public void setObjectMethod(java.lang.Class entityClz,
                            java.lang.Class attrClaz)
This implementation finds the given method in the given object and stores the Method reference for invocation by validateValue.


getMethodName

public java.lang.String getMethodName()
Gets the name of the method invoked by this validator.

Returns:
the name of a Java method.

getMethod

public java.lang.reflect.Method getMethod()
Gets the method invoked by this validator.

Returns:
a method object, a description of a Java method.

toString

public java.lang.String toString()
Internal: For debugging purposes only.

Overrides:
toString in class java.lang.Object

getDescription

public java.lang.String getDescription()
Gets the textul description of this validator.

Specified by:
getDescription in interface JbiValidator
Overrides:
getDescription in class AbstractValidator
Returns:
a documentation string.

setDescription

public void setDescription(java.lang.String description)
Sets the textul description of this validator.

Specified by:
setDescription in interface JbiValidator
Overrides:
setDescription in class AbstractValidator
Parameters:
description - a documentation string.

loadXMLContents

public void loadXMLContents(DefElement elem)
Overrides:
loadXMLContents in class JboBaseValidator

Oracle Fusion Middleware Java API Reference for Oracle ADF Model
11g Release 1 (11.1.1)

E10653-04

Copyright © 1997, 2010, Oracle. All rights reserved.