Coverage Report - org.apache.onami.autobind.example.starter.ExampleStartupModule
 
Classes in this File Line Coverage Branch Coverage Complexity
ExampleStartupModule
0%
0/5
N/A
1
 
 1  
 /**
 2  
  * Copyright (C) 2010 Daniel Manzke <daniel.manzke@googlemail.com>
 3  
  *
 4  
  * Licensed under the Apache License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  *         http://www.apache.org/licenses/LICENSE-2.0
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 package org.apache.onami.autobind.example.starter;
 17  
 
 18  
 import org.apache.onami.autobind.annotations.Bind;
 19  
 import org.apache.onami.autobind.annotations.GuiceModule;
 20  
 import org.apache.onami.autobind.annotations.features.AutoBindingFeature;
 21  
 import org.apache.onami.autobind.annotations.features.MultiBindingFeature;
 22  
 import org.apache.onami.autobind.configuration.StartupModule;
 23  
 import org.apache.onami.autobind.scanner.ClasspathScanner;
 24  
 import org.apache.onami.autobind.scanner.PackageFilter;
 25  
 import org.apache.onami.autobind.scanner.features.ScannerFeature;
 26  
 
 27  
 import com.google.inject.Binder;
 28  
 import com.google.inject.CreationException;
 29  
 import com.google.inject.multibindings.Multibinder;
 30  
 
 31  
 
 32  
 /**
 33  
  * The {@link ExampleStartupModule} overwrites the
 34  
  * bindAnnotationListeners-Method, because our Example has several Classes
 35  
  * annotated with {@link Bind} and {@link GuiceModule}. Due the fact, that our
 36  
  * GuiceModule binds the {@link Example}-Interface to the {@link ExampleImpl}
 37  
  * -Class and the {@link AutoBindingFeature} too, we would get a
 38  
  * {@link CreationException}.
 39  
  * 
 40  
  * @author Daniel Manzke
 41  
  * 
 42  
  */
 43  
 public class ExampleStartupModule extends StartupModule {
 44  
 
 45  
         public ExampleStartupModule(Class<? extends ClasspathScanner> scanner, PackageFilter... packages) {
 46  0
                 super(scanner, packages);
 47  0
         }
 48  
 
 49  
         @Override
 50  
         protected Multibinder<ScannerFeature> bindFeatures(Binder binder) {
 51  0
                 Multibinder<ScannerFeature> listeners = Multibinder.newSetBinder(binder,
 52  
                         ScannerFeature.class);
 53  0
                 listeners.addBinding().to(MultiBindingFeature.class);
 54  0
                 return listeners;
 55  
         }
 56  
 
 57  
 }