Home | History | Annotate | Download | only in internal
      1 /**
      2  * Copyright (C) 2008 Google Inc.
      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 
     17 package com.google.inject.internal;
     18 
     19 import com.google.common.collect.Lists;
     20 import com.google.inject.spi.PrivateElements;
     21 
     22 import java.util.List;
     23 
     24 /**
     25  * Handles {@code Binder.newPrivateBinder()} elements.
     26  *
     27  * @author jessewilson (at) google.com (Jesse Wilson)
     28  */
     29 final class PrivateElementProcessor extends AbstractProcessor {
     30 
     31   private final List<InjectorShell.Builder> injectorShellBuilders = Lists.newArrayList();
     32 
     33   PrivateElementProcessor(Errors errors) {
     34     super(errors);
     35   }
     36 
     37   @Override public Boolean visit(PrivateElements privateElements) {
     38     InjectorShell.Builder builder = new InjectorShell.Builder()
     39         .parent(injector)
     40         .privateElements(privateElements);
     41     injectorShellBuilders.add(builder);
     42     return true;
     43   }
     44 
     45   public List<InjectorShell.Builder> getInjectorShellBuilders() {
     46     return injectorShellBuilders;
     47   }
     48 }
     49