public class Condition
extends java.lang.RuntimeException
OnUnit
s specify the handler code for Conditions.Modifier and Type | Class and Description |
---|---|
static class |
Condition.CONDITION
CONDITION - the PL/I defined CONDITIONs
|
static class |
Condition.MessagesAndCodes
MessagesAndCodes - the Elastic PL/I CONDITION codes and their messages.
|
Modifier and Type | Field and Description |
---|---|
static int |
BYTES
size in bytes if converted to a byte array
hint: cannot be converted to a byte array
|
Constructor and Description |
---|
Condition()
Construct an unknown condition or internal error
|
Condition(Condition.CONDITION condition,
Condition.MessagesAndCodes messageAndCode)
Construct a specific condition with a known message and code
|
Condition(Condition.CONDITION condition,
Condition.MessagesAndCodes messageAndCode,
Condition on,
java.lang.Object... otherMessages)
Construct a specific condition with a known message, other info
|
Condition(Condition.CONDITION condition,
Condition.MessagesAndCodes messageAndCode,
int subcode1)
Construct a specific condition with a known message, code and subcode
|
Condition(Condition.CONDITION condition,
Condition.MessagesAndCodes messageAndCode,
int subcode1,
java.lang.String on)
Construct a specific condition with a known message and code
|
Condition(Condition.CONDITION condition,
Condition.MessagesAndCodes messageAndCode,
IPLIFile on,
java.lang.Object... otherMessages)
Construct a specific condition with a known message, other info
|
Condition(Condition.CONDITION condition,
Condition.MessagesAndCodes messageAndCode,
java.lang.String on)
Construct a specific condition with a known message and code, referencing another condition
|
Condition(Condition.CONDITION condition,
Condition.MessagesAndCodes messageAndCode,
java.lang.String on,
java.lang.Object... otherMessages)
Construct a specific condition with a known message, other info
|
Condition(Condition.CONDITION condition,
java.lang.String... description)
Construct a specific condition with a known message, other info
|
Condition(java.lang.String description)
Construct an ERROR
Condition with a specific error message |
Modifier and Type | Method and Description |
---|---|
static void |
Activate(OnUnit onUnit)
Activate the condition associated with the given
OnUnit . |
java.lang.Integer |
code()
Return the code associated with this CONDITION
|
Condition.CONDITION |
conditiion()
Return the CONDITION associated with this Condition
|
java.lang.String |
condition()
Return the CONDITION name
|
static void |
Disable(Condition.CONDITION condition)
Disable a condition within this block
|
static void |
Enable(Condition.CONDITION condition)
Enable a condition within this block
|
boolean |
equals(Condition.CONDITION otherCONDITION,
java.lang.String otherOn)
Return whether two conditions equal
|
boolean |
equals(java.lang.Object other)
Return whether the contents of two conditions equal, either
full Conditions or just the CONDITION type
|
java.lang.String |
getCodeAndMessage()
Return the String representation of the
MessageAndCode associated with this
Condition |
boolean |
handle()
handle this Condition by invoking the Activated OnUnit that is currently in effect.
|
static boolean |
IsEnabled(Condition.CONDITION condition)
indicate whether a condition is currently enabled
|
static boolean |
IsEnabled(Condition condition)
indicate whether a condition is currently enabled
|
static Condition |
LastCondition()
Return the last Condition raised by the program
|
static Condition.CONDITION |
LastIgnoredCondition()
Return the last Condition that was checked (but perhaps not raised)
|
static void |
main(java.lang.String[] args)
unit test case for Condition
|
java.lang.String |
message()
Return the message associated with this CONDITION
|
Condition |
onCondition()
Return the user defined Condition variable for which this CONDITION was raised
|
java.lang.String |
onFile()
Return the file for which this CONDITION was raised
|
java.lang.String |
onName()
Return the named element (e.g.
|
static void |
OnSystem(Condition.CONDITION condition,
IPLIFile onFile,
Condition onCondition,
boolean snap)
|
static boolean |
Pop(Condition.CONDITION condition)
Pop the enable/disable status for a condition within this block
|
static void |
Push(Condition.CONDITION condition)
Push the enable/disable status for a condition within this block
|
static int |
RaiseCondition(Condition.CONDITION condition)
Static method that constructs and then throws a Condition if it is enabled.
|
static int |
RaiseCondition(Condition.CONDITION condition,
Condition.MessagesAndCodes messageAndCode)
Static method that constructs and then throws a Condition if it is enabled.
|
static int |
RaiseCondition(Condition.CONDITION condition,
Condition.MessagesAndCodes messageAndCode,
Condition on,
java.lang.Object... otherMessages)
Static method that constructs and then throws a Condition if it is enabled.
|
static int |
RaiseCondition(Condition.CONDITION condition,
Condition.MessagesAndCodes messageAndCode,
IPLIFile on,
java.lang.Object... otherMessages)
Static method that constructs and then throws a Condition if it is enabled.
|
static int |
RaiseCondition(Condition.CONDITION condition,
Condition.MessagesAndCodes messageAndCode,
java.lang.String on,
java.lang.Object... otherMessages)
Static method that constructs and then throws a Condition if it is enabled.
|
static int |
RaiseCondition(Condition.CONDITION condition,
java.lang.String description)
Static method that constructs and then throws a Condition if it is enabled.
|
static void |
Reset()
reset the Condition messages file using the current default locale
|
static void |
Revert(OnUnit onUnit)
Revert the condition associated with the given
OnUnit to the
prior one defined (or default action if none were previously activated). |
static void |
Snap(Condition.CONDITION condition)
Snap - snap a trace back
|
int |
subcode()
Return the subcode associated with this CONDITION
|
java.lang.String |
summary()
Return the summary description of this condition
(without messages & codes)
|
java.lang.String |
toString()
Return a debugging string describing this Condition
|
static Condition |
valueOf(java.lang.Throwable throwable) |
public static final int BYTES
public Condition()
public Condition(Condition.CONDITION condition, Condition.MessagesAndCodes messageAndCode)
condition
- - CONDITION
to throwmessageAndCode
- - MessageAndCode
with specific messagepublic Condition(Condition.CONDITION condition, Condition.MessagesAndCodes messageAndCode, int subcode1)
condition
- - CONDITION
to throwmessageAndCode
- - MessageAndCode
with specific messagesubcode1
- and a more detailed sub-codepublic Condition(Condition.CONDITION condition, Condition.MessagesAndCodes messageAndCode, java.lang.String on)
condition
- - CONDITION
to throwmessageAndCode
- - MessageAndCode
with specific messageon
- - a condition name (CONDITION condition), file name (KEY, ENDFILE, UNDEFINEDFILE)public Condition(Condition.CONDITION condition, Condition.MessagesAndCodes messageAndCode, int subcode1, java.lang.String on)
condition
- - CONDITION
to throwmessageAndCode
- - MessageAndCode
with specific messagesubcode1
- - a more detailed sub-codeon
- - a condition name (CONDITION condition), file name (KEY, ENDFILE, UNDEFINEDFILE)public Condition(Condition.CONDITION condition, Condition.MessagesAndCodes messageAndCode, java.lang.String on, java.lang.Object... otherMessages)
condition
- - CONDITION
to throwmessageAndCode
- - MessageAndCode
with specific messageon
- - a condition name (CONDITION condition), file name (KEY, ENDFILE, UNDEFINEDFILE)otherMessages
- - and a more detailed message components to insert
into the MessageAndCodes templatepublic Condition(Condition.CONDITION condition, Condition.MessagesAndCodes messageAndCode, IPLIFile on, java.lang.Object... otherMessages)
condition
- - CONDITION
to throwmessageAndCode
- - MessageAndCode
with specific messageon
- - a IPLIFile
associated with some conditions (KEY, ENDFILE, UNDEFINEDFILE)otherMessages
- - and a more detailed message components to insert
into the MessageAndCodes templatepublic Condition(Condition.CONDITION condition, Condition.MessagesAndCodes messageAndCode, Condition on, java.lang.Object... otherMessages)
condition
- - CONDITION
to throwmessageAndCode
- - MessageAndCode
with specific messageon
- - a user-defined Condition variableotherMessages
- - and a more detailed message components to insert
into the MessageAndCodes templatepublic Condition(java.lang.String description)
Condition
with a specific error messagedescription
- - associated with an ERROR Conditionpublic Condition(Condition.CONDITION condition, java.lang.String... description)
condition
- - CONDITION
to throwdescription
- - and a more detailed message components to insert
into the MessageAndCodes templatepublic static Condition LastCondition()
public static Condition.CONDITION LastIgnoredCondition()
public static Condition valueOf(java.lang.Throwable throwable)
public static int RaiseCondition(Condition.CONDITION condition, Condition.MessagesAndCodes messageAndCode, java.lang.String on, java.lang.Object... otherMessages)
condition
- - CONDITION
to throwmessageAndCode
- - MessageAndCode
with specific messageon
- - a condition name (CONDITION condition), file name (KEY, ENDFILE, UNDEFINEDFILE)otherMessages
- - and a more detailed message components to insert
into the MessageAndCodes templateCondition
- if enabled but not handledpublic static int RaiseCondition(Condition.CONDITION condition, Condition.MessagesAndCodes messageAndCode, Condition on, java.lang.Object... otherMessages)
condition
- - CONDITION
to throwmessageAndCode
- - MessageAndCode
with specific messageon
- - a user-defined Condition (CONDITION condition)otherMessages
- - and a more detailed message components to insert
into the MessageAndCodes templateCondition
- if enabled but not handledpublic static int RaiseCondition(Condition.CONDITION condition, Condition.MessagesAndCodes messageAndCode, IPLIFile on, java.lang.Object... otherMessages)
condition
- - CONDITION
to throwmessageAndCode
- - MessageAndCode
with specific messageon
- - a IPLIFile
associated with some conditions (KEY, ENDFILE, UNDEFINEDFILE)otherMessages
- - and a more detailed message components to insert
into the MessageAndCodes templateCondition
- if enabled but not handledpublic static int RaiseCondition(Condition.CONDITION condition, Condition.MessagesAndCodes messageAndCode)
condition
- - CONDITION
to throwmessageAndCode
- - MessageAndCode
with specific messageCondition
- if enabled but not handledpublic static int RaiseCondition(Condition.CONDITION condition)
public static int RaiseCondition(Condition.CONDITION condition, java.lang.String description)
public Condition.CONDITION conditiion()
public java.lang.Integer code()
public int subcode()
public java.lang.String message()
public java.lang.String onName()
public java.lang.String onFile()
public Condition onCondition()
public java.lang.String condition()
public java.lang.String summary()
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
other
- - the other Condition or Condition.CONDITIONpublic boolean equals(Condition.CONDITION otherCONDITION, java.lang.String otherOn)
otherCONDITION
- - the other ConditionotherOn
- - the other Condition's "ON" attributepublic java.lang.String getCodeAndMessage()
MessageAndCode
associated with this
Conditionpublic java.lang.String toString()
toString
in class java.lang.Throwable
public static boolean IsEnabled(Condition.CONDITION condition)
condition
- - the simple Condition.CONDITION to check, irrespective of any ON file or variablepublic static boolean IsEnabled(Condition condition)
condition
- - the full Condition to check, including the ON file or condition variablepublic boolean handle()
public static void Activate(OnUnit onUnit)
OnUnit
.onUnit
- - the OnUnit
defining the Condition to activate
and the handler that should be invoked should RaiseCondition occur on itpublic static void Revert(OnUnit onUnit)
OnUnit
to the
prior one defined (or default action if none were previously activated).onUnit
- - the OnUnit
defining the Condition to revert
and the handler that should be invoked should RaiseCondition occur on itpublic static void OnSystem(Condition.CONDITION condition, IPLIFile onFile, Condition onCondition, boolean snap)
OnUnit
processing as it applies to revert a specific OnUnit
that is
associated with a condition.condition
- - the Condition.CONDITION
on which the "ON condition SYSTEM;" is being invokedonFile
- - the IPLIFile
variable associated with the condition, if it is that type (optional)onCondition
- - the Condition
variable associated with the condition, if it is that type (optional)snap
- - boolean indicating that SNAP was specified on the ON statementpublic static void Snap(Condition.CONDITION condition)
condition
- - the condition to enablepublic static void Enable(Condition.CONDITION condition)
condition
- - the condition to enablepublic static void Disable(Condition.CONDITION condition)
condition
- - the condition to disablepublic static void Push(Condition.CONDITION condition)
condition
- - the condition to push (retains the same state
as the prior value which is ENABLED by default)public static boolean Pop(Condition.CONDITION condition)
condition
- - the condition to push (retains the same state
as the prior value which is ENABLED by default)public static void Reset()
public static void main(java.lang.String[] args)