コード例 #1
0
ファイル: Elements.java プロジェクト: utopiazh/google-guice
 /** 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
ファイル: Elements.java プロジェクト: utopiazh/google-guice
    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;
    }