Package paypal.payflow
Class Context
java.lang.Object
paypal.payflow.Context
This class contains all error messages generated for the class containing
the context.This also contains the highest severity level contained by the
context.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddError(ErrorObject errObject) This method adds the passed error object in the array list contained by the context objectprotected voidThis method adds the passed arraylist of error objects to the context objectvoidThis resets the context objectgetError(int index) This method will return the error object from the Context as per the index passed to the function.If the index value passed is more than the count of the errors in the array list then it returns a null.intThis method will return the total number of errors contained in the Context Object.This method returns the array list populated with all the error contained in the contextgetErrors(int sevLvl) This method will return the array list populated with all the error contained in the context which are equal to or above the severity level passed to the functionintIndicates the highest severity level error contained in the Context.protected booleanIndicates if the Error messages due to Logger class needs to be added to the context.protected booleanThis method will check if the context contains a specific error message.This method can be used for checking if the context is empty.booleanThis method will check if the context contains any error message.This method can be used for checking if the context is empty.booleanThis method will log all the error and exceptions contained in the ErrorObjects arraylist.This returns true if the logging is successful.protected voidsetLoadLoggerErrs(boolean value) This function can be set to check if logger errors need to be logged.toString()This method overrides the toString() method of the System.Object Class.This method converts the information in the Context in the string format.The format is as follows: *This method is another overload for the method toString().This method converts the information in the Context in the string format.This will return the formatted error string for messages that have severity level equal to or above the severitylevel parameter passed to this function.The messages for different errors are separated by the separator format passed to the method.In case no separator is passed a new line character is used.
-
Constructor Details
-
Context
protected Context()Constructor for Context
-
-
Method Details
-
getHighestErrorLvl
public int getHighestErrorLvl()Indicates the highest severity level error contained in the Context.- Returns:
- highestErrorLvl int
-
getLoadLoggerErrs
protected boolean getLoadLoggerErrs()Indicates if the Error messages due to Logger class needs to be added to the context.- Returns:
- mLoadLoggerErrs boolean
-
setLoadLoggerErrs
protected void setLoadLoggerErrs(boolean value) This function can be set to check if logger errors need to be logged.- Parameters:
value- boolean
-
addError
This method adds the passed error object in the array list contained by the context object- Parameters:
errObject- ErrorObject
-
addErrors
This method adds the passed arraylist of error objects to the context object- Parameters:
errorObjects- ArrayList
-
logErrors
public boolean logErrors()This method will log all the error and exceptions contained in the ErrorObjects arraylist.This returns true if the logging is successful.- Returns:
- retVal boolean
-
isErrorContained
public boolean isErrorContained()This method will check if the context contains any error message.This method can be used for checking if the context is empty.- Returns:
- errorContained boolean
-
isCommunicationErrorContained
This method will check if the context contains a specific error message.This method can be used for checking if the context is empty.- Parameters:
error- ErrorObject- Returns:
- retFlag boolean
-
getError
This method will return the error object from the Context as per the index passed to the function.If the index value passed is more than the count of the errors in the array list then it returns a null.- Parameters:
index- int- Returns:
- errobject ErrorObject
-
getErrors
This method returns the array list populated with all the error contained in the context- Returns:
- mErrorObjects ArrayList
-
getErrors
This method will return the array list populated with all the error contained in the context which are equal to or above the severity level passed to the function- Parameters:
sevLvl- int- Returns:
- highSevErrors ArrayList
-
getErrorCount
public int getErrorCount()This method will return the total number of errors contained in the Context Object.- Returns:
- errorCOunt int
-
toString
This method overrides the toString() method of the System.Object Class.This method converts the information in the Context in the string format.The format is as follows: *"Message (Message Number in the context) :[(Message severity Level)](Message code)-(Formatted message body with context info) Message stack Trace"
-
toString
This method is another overload for the method toString().This method converts the information in the Context in the string format.This will return the formatted error string for messages that have severity level equal to or above the severitylevel parameter passed to this function.The messages for different errors are separated by the separator format passed to the method.In case no separator is passed a new line character is used.- Parameters:
severityLevel- intseperator- String- Returns:
- retVal String
-
clearErrors
public void clearErrors()This resets the context object
-