1aff72e051a38af75e8a6bce59d1a9a4b760d914bphopkins/** 2aff72e051a38af75e8a6bce59d1a9a4b760d914bphopkins * Copyright (C) 2008 Google Inc. 3aff72e051a38af75e8a6bce59d1a9a4b760d914bphopkins * 4aff72e051a38af75e8a6bce59d1a9a4b760d914bphopkins * Licensed under the Apache License, Version 2.0 (the "License"); 5aff72e051a38af75e8a6bce59d1a9a4b760d914bphopkins * you may not use this file except in compliance with the License. 6aff72e051a38af75e8a6bce59d1a9a4b760d914bphopkins * You may obtain a copy of the License at 7aff72e051a38af75e8a6bce59d1a9a4b760d914bphopkins * 8aff72e051a38af75e8a6bce59d1a9a4b760d914bphopkins * http://www.apache.org/licenses/LICENSE-2.0 9aff72e051a38af75e8a6bce59d1a9a4b760d914bphopkins * 10aff72e051a38af75e8a6bce59d1a9a4b760d914bphopkins * Unless required by applicable law or agreed to in writing, software 11aff72e051a38af75e8a6bce59d1a9a4b760d914bphopkins * distributed under the License is distributed on an "AS IS" BASIS, 12aff72e051a38af75e8a6bce59d1a9a4b760d914bphopkins * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13aff72e051a38af75e8a6bce59d1a9a4b760d914bphopkins * See the License for the specific language governing permissions and 14aff72e051a38af75e8a6bce59d1a9a4b760d914bphopkins * limitations under the License. 15aff72e051a38af75e8a6bce59d1a9a4b760d914bphopkins */ 16aff72e051a38af75e8a6bce59d1a9a4b760d914bphopkins 17aff72e051a38af75e8a6bce59d1a9a4b760d914bphopkinspackage com.google.inject.grapher.demo; 18aff72e051a38af75e8a6bce59d1a9a4b760d914bphopkins 19aff72e051a38af75e8a6bce59d1a9a4b760d914bphopkinsimport com.google.inject.AbstractModule; 20aff72e051a38af75e8a6bce59d1a9a4b760d914bphopkinsimport com.google.inject.multibindings.Multibinder; 21aff72e051a38af75e8a6bce59d1a9a4b760d914bphopkins 22aff72e051a38af75e8a6bce59d1a9a4b760d914bphopkins/** 23aff72e051a38af75e8a6bce59d1a9a4b760d914bphopkins * Module to add {@link Multibinder}-based bindings to the injector. 24aff72e051a38af75e8a6bce59d1a9a4b760d914bphopkins * 25aff72e051a38af75e8a6bce59d1a9a4b760d914bphopkins * @author phopkins@gmail.com (Pete Hopkins) 26aff72e051a38af75e8a6bce59d1a9a4b760d914bphopkins */ 27aff72e051a38af75e8a6bce59d1a9a4b760d914bphopkinspublic class MultibinderModule extends AbstractModule { 28aff72e051a38af75e8a6bce59d1a9a4b760d914bphopkins @Override 29aff72e051a38af75e8a6bce59d1a9a4b760d914bphopkins protected void configure() { 30aff72e051a38af75e8a6bce59d1a9a4b760d914bphopkins Multibinder<Person> charactersBinder = Multibinder.newSetBinder(binder(), Person.class); 31aff72e051a38af75e8a6bce59d1a9a4b760d914bphopkins charactersBinder.addBinding().to(MartyMcFly.class); 32aff72e051a38af75e8a6bce59d1a9a4b760d914bphopkins charactersBinder.addBinding().to(DocBrown.class); 33aff72e051a38af75e8a6bce59d1a9a4b760d914bphopkins } 34aff72e051a38af75e8a6bce59d1a9a4b760d914bphopkins} 35