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

E10653-05

oracle.jbo.rules
Class JboMethodValidator

java.lang.Object
  extended by oracle.jbo.common.NamedObjectImpl
      extended by oracle.jbo.rules.AbstractValidator
          extended by oracle.jbo.rules.JboAbstractValidator
              extended by oracle.jbo.rules.JboMethodValidator
All Implemented Interfaces:
DefPersistable, PersistentDefinition, JboTransValidatorInterface, JboValidatorHints, JboValidatorInterface, ValidatorConstants, VariableManagerOwner, VariableManagerOwnerBase

public class JboMethodValidator
extends JboAbstractValidator
implements JboTransValidatorInterface

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.rules.JboAbstractValidator
mValidatingAttr
 
Fields inherited from class oracle.jbo.rules.AbstractValidator
mbInverse, mDescription, mErrorMessageClass, mMsgExpr, mMsgId, mMsgIds, mResourceBundleId, mTriggeringAttributeNames, mTriggeringAttributes, mValidatingAttrName
 
Fields inherited from class oracle.jbo.common.NamedObjectImpl
mFullName, mObjName, mParent, mProperties, RES_ID_SUFFIX
 
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, NOTEQUALTO, PNAME_CompareLength, PNAME_CompareType, PNAME_CompareValue, PNAME_DataType, PNAME_Description, PNAME_ErrorMessageExpressions, PNAME_ErrorMessageId, PNAME_ErrorMessageIds, PNAME_Exposed, PNAME_ExprValueSupplier, PNAME_ForPersonalization, PNAME_Inverse, PNAME_Name, PNAME_OnAttribute, PNAME_OnAttributes, PNAME_OnCondition, PNAME_OperandType, PNAME_Severity, PNAME_Subtype, PNAME_TransactionLevel, PNAME_TransientExpression, PNAME_Trigger, 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
 
Fields inherited from interface oracle.jbo.mom.xml.DefPersistable
XML_STATEMENT
 
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 getDefXMLElementTag()
           
 java.lang.String getErrorMsgId()
           
 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 initValidatorProperties(java.util.HashMap props)
           
 void loadXMLContents(DefElement elem)
           
protected  void prepareException(ValidationException valEx, JboValidatorContext evObj, int severity)
           
 void raiseException(java.lang.Exception e, JboValidatorContext evObj, java.lang.String msgId, int severity)
           
 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.
 void setTransactionLevel(boolean bTransactionLevel)
           
 java.lang.String toString()
          Internal: For debugging purposes only.
 void validateMany(java.util.ArrayList valCtxs)
           
 boolean validateValue(java.lang.Object value)
          Validates a value.
 boolean validateValueWithContext(JboValidatorContext evObj, java.lang.Object value)
          Called internally by the framework with validation OnCondition is true or there is no validation OnCondition.
 void writeContents(DefWriter jos)
          Objects should write their persistence output in this method
 
Methods inherited from class oracle.jbo.rules.JboAbstractValidator
applyValidatorPersonalization, clone, closeObject, getDefXMLNameSpace, getErrorReportAttrDef, getFullName, getImageLoc, getName, getOrigObject, getTriggeringAttributeDefs, getValidatingAttributeName, getValidatorType, getValueToValidate, getXMLElementTag, initialize, isForPersonalization, isReadOnly, resolve, setForPersonalization, setInitialized, setName, setNewValue, setOrigObject, setValidatingAttribute, setValidatingAttribute, validate, writeObject
 
Methods inherited from class oracle.jbo.rules.AbstractValidator
applyValidatorPersonalization, convertToJava, copyErrorMsgInfo, createException, createExprValueSupplier, ensureVariableManager, getDescription, getErrorMessageClass, getErrorMsgExpressions, getErrorMsgIds, getExprValueSupplierType, getInverse, getMessageBundleClass, getOnCondition, getOwner, getResourceBundleDef, getResourceBundleId, getSeverity, getTriggeringAttributeNames, getValidatorSubType, getVariableManager, hasErrorMsg, hasValidationCondition, hasVariables, initErrMsgParms, initTriggeringAttributeDefs, isDirty, isMovedToAttrLevel, isNew, isTransactionLevel, isTransactionLevel, isValidatable, loadVariables, parseSeverityStr, raiseException, readStringArrayList, readTransientExpression, readUserObject, readUserObject, readUserObjectTrim, readUserObjectTrim, readUserStringElementsMap, setDefaultDescription, setDescription, setDirty, setErrorMessageClass, setErrorMsgExpressions, setErrorMsgId, setErrorMsgIds, setExprValueSupplierType, setInverse, setNew, setOnCondition, setResourceBundleDef, setResourceBundleId, setSeverity, setTriggeringAttributeNames, setValidatingAttributeName, writeChildren
 
Methods inherited from class oracle.jbo.common.NamedObjectImpl
allocatePropertyMap, getAllProperties, getParent, getProperties, getPropertiesAsStrings, getPropertiesMap, getProperty, getProperty, getPropertyExpressionsMap, getPropertyMap, getResourcesFromBundle, getStringFromMessageBundle, isPropertyExpression, mergePropertyMap, refreshProperty, removeProperty, removeProperty, requiresNamePrefixedResId, resolveObjectProperty, resolvePropertyRaw, setFullName, setParent, setPropertiesMap, setPropertiesMap2, setProperty, setProperty, setPropertyExpression, setPropertyMap
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface oracle.jbo.rules.JboValidatorInterface
getDescription, setDescription, validate
 
Methods inherited from interface oracle.jbo.rules.JboValidatorHints
getTriggeringAttributeNames, isTransactionLevel
 
Methods inherited from interface oracle.jbo.mom.xml.DefPersistable
isDirty, isNew, setDirty, setNew
 
Methods inherited from interface oracle.jbo.mom.xml.PersistentDefinition
writeChildren
 

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

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.


prepareException

protected void prepareException(ValidationException valEx,
                                JboValidatorContext evObj,
                                int severity)
Overrides:
prepareException in class AbstractValidator
For internal use only. Application developers should not use this

getErrorMsgId

public java.lang.String getErrorMsgId()
Overrides:
getErrorMsgId in class JboAbstractValidator

validateMany

public void validateMany(java.util.ArrayList valCtxs)
Specified by:
validateMany in interface JboTransValidatorInterface
Overrides:
validateMany in class JboAbstractValidator

validateValueWithContext

public boolean validateValueWithContext(JboValidatorContext evObj,
                                        java.lang.Object value)
Description copied from class: JboAbstractValidator
Called internally by the framework with validation OnCondition is true or there is no validation OnCondition. This method should not be directly invoked in applications.

Overrides:
validateValueWithContext in class JboAbstractValidator

raiseException

public void raiseException(java.lang.Exception e,
                           JboValidatorContext evObj,
                           java.lang.String msgId,
                           int severity)
Overrides:
raiseException in class JboAbstractValidator

validateValue

public boolean validateValue(java.lang.Object value)
Description copied from class: JboAbstractValidator
Validates a value.

Subclasses must implement this method.

Specified by:
validateValue in class JboAbstractValidator
Parameters:
value - the object to be validated.
Returns:
true if the object is valid.

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.

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.

setTransactionLevel

public void setTransactionLevel(boolean bTransactionLevel)
Overrides:
setTransactionLevel in class AbstractValidator

toString

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

Overrides:
toString in class java.lang.Object

initValidatorProperties

public void initValidatorProperties(java.util.HashMap props)
Specified by:
initValidatorProperties in interface JboValidatorHints
Overrides:
initValidatorProperties in class AbstractValidator

getDefXMLElementTag

public java.lang.String getDefXMLElementTag()
Specified by:
getDefXMLElementTag in interface PersistentDefinition
Specified by:
getDefXMLElementTag in class JboAbstractValidator

loadXMLContents

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

writeContents

public void writeContents(DefWriter jos)
Description copied from interface: PersistentDefinition
Objects should write their persistence output in this method

Specified by:
writeContents in interface PersistentDefinition
Overrides:
writeContents in class JboAbstractValidator
Parameters:
jos - the Output storage for persistence

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

E10653-05

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