/** * Adds a case that invokes the given closure when this switcher is executed on an object equal to the given one. * @param object The object to be matched * @param closure The closure invoked when this case is executed * @return The switcher itself */ public Switcher<T> addCase(Object object, AbstractClosure closure) { return addCase(equalTo(object), closure); }
/** * Adds a case that returns the given result when this switcher is executed on an object equal to the given one. * @param object The object to be matched * @param result The value returned when this case is executed * @return The switcher itself */ public Switcher<T> addCase(Object object, T result) { return addCase(equalTo(object), result); }