Пример #1
0
 /** Creates a private recording binder. */
 private RecordingBinder(RecordingBinder parent, PrivateElementsImpl privateElements) {
   this.stage = parent.stage;
   this.modules = Sets.newHashSet();
   this.elements = privateElements.getElementsMutable();
   this.source = parent.source;
   this.sourceProvider = parent.sourceProvider;
   this.parent = parent;
   this.privateElements = privateElements;
 }
Пример #2
0
    private <T> AnnotatedElementBuilder exposeInternal(Key<T> key) {
      if (privateElements == null) {
        addError(
            "Cannot expose %s on a standard binder. "
                + "Exposed bindings are only applicable to private binders.",
            key);
        return new AnnotatedElementBuilder() {
          public void annotatedWith(Class<? extends Annotation> annotationType) {}

          public void annotatedWith(Annotation annotation) {}
        };
      }

      ExposureBuilder<T> builder = new ExposureBuilder<T>(this, getSource(), key);
      privateElements.addExposureBuilder(builder);
      return builder;
    }