/** * Attempts to applied the specified or default {@link Governor} to the incoming object. The * return type of the {@link Governor} should be the same as the {@code type} parameter or at * least be cast-able to that type. * * @param o - this incoming value to govern * @param type - the type to which the return value is cast * @return */ default <T extends Object> T govern(Object o, Class<T> type) { String currentMethod = Thread.currentThread().getStackTrace()[2].getMethodName(); Method m = null; Governor governor = (findGovernor(currentMethod, m)); return type.cast(governor.govern(o)); }