Class Context

java.lang.Object
paypal.payflow.Context

public final class Context extends Object
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
    Modifier
    Constructor
    Description
    protected
    Constructor for Context
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    addError(ErrorObject errObject)
    This method adds the passed error object in the array list contained by the context object
    protected void
    addErrors(ArrayList errorObjects)
    This method adds the passed arraylist of error objects to the context object
    void
    This resets the context object
    getError(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.
    int
    This 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 context
    getErrors(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 function
    int
    Indicates the highest severity level error contained in the Context.
    protected boolean
    Indicates if the Error messages due to Logger class needs to be added to the context.
    protected boolean
    This method will check if the context contains a specific error message.This method can be used for checking if the context is empty.
    boolean
    This method will check if the context contains any error message.This method can be used for checking if the context is empty.
    boolean
    This method will log all the error and exceptions contained in the ErrorObjects arraylist.This returns true if the logging is successful.
    protected void
    setLoadLoggerErrs(boolean value)
    This function can be set to check if logger errors need to be logged.
    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: *
    toString(int severityLevel, String seperator)
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • 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

      protected void addError(ErrorObject errObject)
      This method adds the passed error object in the array list contained by the context object
      Parameters:
      errObject - ErrorObject
    • addErrors

      protected void addErrors(ArrayList errorObjects)
      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

      protected boolean isCommunicationErrorContained(ErrorObject error)
      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

      public ErrorObject getError(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.
      Parameters:
      index - int
      Returns:
      errobject ErrorObject
    • getErrors

      public ArrayList getErrors()
      This method returns the array list populated with all the error contained in the context
      Returns:
      mErrorObjects ArrayList
    • getErrors

      public ArrayList getErrors(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 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

      public String 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"

      Overrides:
      toString in class Object
      Returns:
      errString String
    • toString

      public String toString(int severityLevel, String seperator)
      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 - int
      seperator - String
      Returns:
      retVal String
    • clearErrors

      public void clearErrors()
      This resets the context object