com.ibm.websphere.brb
Class ConstraintReturn

java.lang.Object
  |
  +--com.ibm.websphere.brb.ConstraintReturn
All Implemented Interfaces:
java.io.Serializable

public class ConstraintReturn
extends java.lang.Object
implements java.io.Serializable

ConstraintReturn is used to represent the result of firing one constraint type rule. The result may be either true (the rule succeeded) or false (the rule failed). If the result is true, the ConstraintReturn object contains no other information. If the result is false, the ConstraintReturn object may contain information indicating what caused the failure. This failure information can be in one of two forms. If the ConstraintReturn represents the result of a rule with no dependent rules, then the resource bundle name, message key, and replacement arguments will be filled in. These are used by getMessage and getLocalizedMessage to produce formatted text indicating the cause of the failure. If the rule represented by this ConstraintReturn has dependent rules, each of which could have their own result, then the ContraintReturn object will contain an array of ConstraintReturn objects representing the dependent rules. An example of this is the base rule implementor RuleAND which ANDs together the results of its dependent rules. If one or more dependent rules fails, then RuleAND will return a ConstraintReturn object that contains an array of ConstraintReturn objects, one for each dependent rule that failed. When getMessage or getLocalizedMessage is called on a ConstraintReturn object that contains an array of ConstraintReturns the final formatted message will be built up from the messages returned by each of the dependent ConstraintReturns.

See Also:
Serialized Form

Field Summary
 java.lang.Object[] arguments
          Array of replacement arguments to be inserted into the message text for this object.
 ConstraintReturn[] constraintReturns
          Array of ConstraintReturns representing results from dependent rules.
protected  com.ibm.websphere.exception.DistributedExceptionInfo exceptionInfo
          Object containing the localization information (resource bundle name, message key, format arguments, and default text) for the message for this ConstraintReturn object.
 boolean result
          The result of the rule represented by this object.
 
Constructor Summary
ConstraintReturn()
          Default ConstraintReturn constructor.
ConstraintReturn(boolean value)
          Constraint return constructor.
ConstraintReturn(boolean inResult, ConstraintReturn[] inConstraintReturns)
          ConstraintReturn constructor.
ConstraintReturn(boolean inResult, java.lang.String inResourceBundleName, java.lang.String inMessageKey, java.lang.Object[] inFormatArgs, java.lang.String inDefaultMessage)
          ConstraintReturn constructor.
 
Method Summary
 java.lang.String getLocalizedMessage()
          Retrieve the message text for this ConstraintReturn object, formatted for the current locale.
 java.lang.String getMessage()
          Retrieve the formatted message text for this ConstraintReturn object, formatted for the current locale.
 boolean result()
          Retrieve the overall result of the rule represented by this object.
 void result(boolean inResult)
          Set the overall result of the rule represented by this object.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

result

public boolean result
The result of the rule represented by this object. A result of true implies the rule succeeded, while false implies the rule failed.

constraintReturns

public ConstraintReturn[] constraintReturns
Array of ConstraintReturns representing results from dependent rules.

exceptionInfo

protected com.ibm.websphere.exception.DistributedExceptionInfo exceptionInfo
Object containing the localization information (resource bundle name, message key, format arguments, and default text) for the message for this ConstraintReturn object.

arguments

public java.lang.Object[] arguments
Array of replacement arguments to be inserted into the message text for this object. Only set if result is false.
Constructor Detail

ConstraintReturn

public ConstraintReturn()
Default ConstraintReturn constructor.

ConstraintReturn

public ConstraintReturn(boolean value)
Constraint return constructor.
Parameters:
value - boolean

ConstraintReturn

public ConstraintReturn(boolean inResult,
                        ConstraintReturn[] inConstraintReturns)
ConstraintReturn constructor.
Parameters:
inResult - Result of rule. A value of true means the rule succeeded, while false means it failed.
inConstraintReturns - Array of ConstraintReturns representing the results of dependent rules.

ConstraintReturn

public ConstraintReturn(boolean inResult,
                        java.lang.String inResourceBundleName,
                        java.lang.String inMessageKey,
                        java.lang.Object[] inFormatArgs,
                        java.lang.String inDefaultMessage)
ConstraintReturn constructor.
Parameters:
inResult - Result of rule. A value of true means the rule succeeded, while false means it failed.
inResourceBundleName - Name of the resource bundle to be used to format the message.
inMessageKey - The key used to look up the message text in the resource bundle.
inFormatArgs - Replacement arguments to be inserted into the message text.
inDefaultMessage - Default text that will be used for the message if there is no resource bundle or message key.
Method Detail

getLocalizedMessage

public java.lang.String getLocalizedMessage()
Retrieve the message text for this ConstraintReturn object, formatted for the current locale.
Returns:
The formatted message.

getMessage

public java.lang.String getMessage()
Retrieve the formatted message text for this ConstraintReturn object, formatted for the current locale.
Returns:
The formatted message.

result

public boolean result()
Retrieve the overall result of the rule represented by this object.
Returns:
A value of true indicates the rule succeeded, while false indicates that it failed.

result

public void result(boolean inResult)
Set the overall result of the rule represented by this object.
Parameters:
inResult - Result of rule. A value of true means the rule succeeded, while false means that it failed.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
java.lang.String