2 * Copyright (c) 2017 Red Hat, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.odlguice.inject.guice.testutils;
10 import com.google.inject.AbstractModule;
11 import com.google.inject.Binder;
12 import org.opendaylight.odlguice.inject.ModuleSetupRuntimeException;
15 * Convenience Guice module support class with configure method that allows
16 * throwing checked exceptions, which are caught and re-thrown as unchecked
17 * {@link ModuleSetupRuntimeException}.
19 * @deprecated Use org.opendaylight.infrautils.inject.guice.AbstractCheckedModule instead.
21 * @author Michael Vorburger.ch
24 public abstract class AbstractCheckedModule extends AbstractModule {
27 * Configures a {@link Binder} via the exposed methods.
29 * @throws ModuleSetupRuntimeException if binding failed
32 @SuppressWarnings("checkstyle:IllegalCatch")
33 protected final void configure() throws ModuleSetupRuntimeException {
36 } catch (Exception e) {
37 throw new ModuleSetupRuntimeException(e);
41 protected abstract void checkedConfigure() throws Exception;