Package src.handler
Class ExceptionHandler
Object
ExceptionHandler
Collection of helper functions to deal with exceptions
- Version:
- 1.0
- Author:
- Lee Juin
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <E> booleanOutOfBoundHandler(int index, ArrayList<E> arrayList) Handler to handle situation when user attempts to access outside index of an array i.e., 5 selections but given int 6 by userstatic booleanTypeMismatchHandler(Object o1, Object o2) Handler to handle potential situation of type mismatch.
-
Constructor Details
-
ExceptionHandler
public ExceptionHandler()Constructor
-
-
Method Details
-
TypeMismatchHandler
Handler to handle potential situation of type mismatch. i.e., system expects an int but got aStringinstead- Parameters:
o1- object of type 1o2- object of type 2- Returns:
trueif type 1 == type 2;falseotherwise
-
OutOfBoundHandler
Handler to handle situation when user attempts to access outside index of an array i.e., 5 selections but given int 6 by user- Type Parameters:
E- generic object for ArrayList- Parameters:
index- index that the user is trying to accessarrayList- ArrayList of generic objects- Returns:
trueif the index is within the array,falseotherwise
-