/** * Starts the Recorder, inserting a tape with the specified parameters. * * @param tapeName the name of the tape. * @param mode the tape mode. If not supplied the default mode from the configuration is * used. * @param matchRule the rules used to match recordings on the tape. If not supplied a default is * used. * @throws IllegalStateException if the Recorder is already started. */ @SuppressWarnings("OptionalUsedAsFieldOrParameterType") public void start(String tapeName, Optional<TapeMode> mode, Optional<MatchRule> matchRule) { if (tape != null) { throw new IllegalStateException("start called when Recorder is already started"); } tape = getTapeLoader().loadTape(tapeName); tape.setMode(mode.or(configuration.getDefaultMode())); tape.setMatchRule(matchRule.or(configuration.getDefaultMatchRule())); configuration.interceptor().start(configuration, tape); for (RecorderListener listener : listeners) { listener.onRecorderStart(tape); } }
/** * Starts the Recorder, inserting a tape with the specified parameters. * * @param tapeName the name of the tape. * @param mode the tape mode. If not supplied the default mode from the configuration is * used. * @param matchRule the rules used to match recordings on the tape. If not supplied a default is * used. * @throws IllegalStateException if the Recorder is already started. */ @SuppressWarnings("OptionalUsedAsFieldOrParameterType") public void start(String tapeName, Optional<TapeMode> mode, Optional<MatchRule> matchRule) { if (tape != null) { throw new IllegalStateException("start called when Recorder is already started"); } tape = getTapeLoader().loadTape(tapeName); tape.setMode(mode.or(configuration.getDefaultMode())); tape.setMatchRule(matchRule.or(configuration.getDefaultMatchRule())); configuration.interceptor().start(configuration, tape); for (RecorderListener listener : listeners) { listener.onRecorderStart(tape); } }