blob: 98454bdbb9b246d771b7aa4c39114c74cb7f8bb1 [file] [log] [blame]
limpbizkitfcbdf992008-11-26 02:37:35 +00001/**
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
limpbizkit5ae41eb2009-06-06 17:51:27 +000017package com.google.inject.internal;
limpbizkitfcbdf992008-11-26 02:37:35 +000018
sberlind9c913a2011-06-26 21:02:54 +000019import com.google.common.collect.Lists;
limpbizkitc3f92842008-12-30 19:43:47 +000020import com.google.inject.spi.PrivateElements;
limpbizkitfcbdf992008-11-26 02:37:35 +000021import java.util.List;
22
23/**
limpbizkit5ae41eb2009-06-06 17:51:27 +000024 * Handles {@code Binder.newPrivateBinder()} elements.
limpbizkitfcbdf992008-11-26 02:37:35 +000025 *
26 * @author jessewilson@google.com (Jesse Wilson)
27 */
limpbizkit5ae41eb2009-06-06 17:51:27 +000028final class PrivateElementProcessor extends AbstractProcessor {
limpbizkitfcbdf992008-11-26 02:37:35 +000029
limpbizkitfcbdf992008-11-26 02:37:35 +000030 private final List<InjectorShell.Builder> injectorShellBuilders = Lists.newArrayList();
31
sberlin8b64d452010-12-13 02:44:36 +000032 PrivateElementProcessor(Errors errors) {
limpbizkitfcbdf992008-11-26 02:37:35 +000033 super(errors);
limpbizkitfcbdf992008-11-26 02:37:35 +000034 }
35
limpbizkit03b81a62009-03-18 05:34:39 +000036 @Override public Boolean visit(PrivateElements privateElements) {
limpbizkitfcbdf992008-11-26 02:37:35 +000037 InjectorShell.Builder builder = new InjectorShell.Builder()
38 .parent(injector)
limpbizkitc3f92842008-12-30 19:43:47 +000039 .privateElements(privateElements);
limpbizkitfcbdf992008-11-26 02:37:35 +000040 injectorShellBuilders.add(builder);
41 return true;
42 }
43
44 public List<InjectorShell.Builder> getInjectorShellBuilders() {
45 return injectorShellBuilders;
46 }
47}