当前位置: 首页>>代码示例>>Java>>正文


Java ScopedBindingBuilder.in方法代码示例

本文整理汇总了Java中com.google.inject.binder.ScopedBindingBuilder.in方法的典型用法代码示例。如果您正苦于以下问题:Java ScopedBindingBuilder.in方法的具体用法?Java ScopedBindingBuilder.in怎么用?Java ScopedBindingBuilder.in使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.inject.binder.ScopedBindingBuilder的用法示例。


在下文中一共展示了ScopedBindingBuilder.in方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: bindingModule

import com.google.inject.binder.ScopedBindingBuilder; //导入方法依赖的package包/类
public Module bindingModule() {
    return new KeyedManifest.Impl(method) {
        @Override
        public void configure() {
            final Binder binder = binder().withSource(method);
            if(!hasReturnValue()) {
                binder.addError("Cannot bind this method as a provider because it does not return a value");
                return;
            }

            install(InjectableMethod.this);

            final ScopedBindingBuilder builder = binder.bind(providedKey).toProvider(asProvider());
            if(scope != null) builder.in(scope);
        }
    };
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:18,代码来源:InjectableMethod.java

示例2: bindFutureProvider

import com.google.inject.binder.ScopedBindingBuilder; //导入方法依赖的package包/类
void bindFutureProvider(PrivateBinder binder) {
  binder = binder.withSource(source);

  ScopedBindingBuilder scoper = binder.bind(bindingKey).toProvider(this);

  if (isVoid(method)) {
    scoper.asEagerSingleton();
  } else {
    if (scopeAnnotation != null) {
      scoper.in(scopeAnnotation);
    }
    if (exposedBinding) {
      binder.expose(bindingKey);
    }
  }
}
 
开发者ID:immutables,项目名称:miscellaneous,代码行数:17,代码来源:Providers.java

示例3: configure

import com.google.inject.binder.ScopedBindingBuilder; //导入方法依赖的package包/类
void configure(Binder binder) {
  binder = binder.withSource(method);

  SecondaryBinder<?, ?> sbinder =
      ThrowingProviderBinder.create(binder).bind(checkedProvider, key.getTypeLiteral());
  if (key.getAnnotation() != null) {
    sbinder = sbinder.annotatedWith(key.getAnnotation());
  } else if (key.getAnnotationType() != null) {
    sbinder = sbinder.annotatedWith(key.getAnnotationType());
  }
  sbinder.scopeExceptions(scopeExceptions);
  ScopedBindingBuilder sbbuilder = sbinder.toProviderMethod(this);
  if (scopeAnnotation != null) {
    sbbuilder.in(scopeAnnotation);
  }

  if (exposed) {
    // the cast is safe 'cause the only binder we have implements PrivateBinder. If there's a
    // misplaced @Exposed, calling this will add an error to the binder's error queue
    ((PrivateBinder) binder).expose(sbinder.getKey());
  }

  CheckedProvideUtils.validateExceptions(
      binder, exceptionTypes, sbinder.getExceptionTypes(), checkedProvider);
}
 
开发者ID:google,项目名称:guice,代码行数:26,代码来源:CheckedProviderMethod.java

示例4: configure

import com.google.inject.binder.ScopedBindingBuilder; //导入方法依赖的package包/类
void configure(Binder binder) {
  binder = binder.withSource(method);

  SecondaryBinder<?, ?> sbinder = 
    ThrowingProviderBinder.create(binder)
      .bind(checkedProvider, key.getTypeLiteral());
  if(key.getAnnotation() != null) {
    sbinder = sbinder.annotatedWith(key.getAnnotation());
  } else if(key.getAnnotationType() != null) {
    sbinder = sbinder.annotatedWith(key.getAnnotationType());
  } 
  ScopedBindingBuilder sbbuilder = sbinder.toProviderMethod(this);
  if(scopeAnnotation != null) {
    sbbuilder.in(scopeAnnotation);
  }

  if (exposed) {
    // the cast is safe 'cause the only binder we have implements PrivateBinder. If there's a
    // misplaced @Exposed, calling this will add an error to the binder's error queue
    ((PrivateBinder) binder).expose(sbinder.getKey());
  }
  
  CheckedProvideUtils.validateExceptions(
      binder, exceptionTypes, sbinder.getExceptionTypes(), checkedProvider);
}
 
开发者ID:cgruber,项目名称:guice-old,代码行数:26,代码来源:CheckedProviderMethod.java

示例5: forAnnotation

import com.google.inject.binder.ScopedBindingBuilder; //导入方法依赖的package包/类
public static Scoping forAnnotation(final Class<? extends Annotation> scopingAnnotation) {
  if (scopingAnnotation == Singleton.class
      || scopingAnnotation == javax.inject.Singleton.class) {
    return SINGLETON_ANNOTATION;
  }

  return new Scoping() {
    @Override public <V> V acceptVisitor(BindingScopingVisitor<V> visitor) {
      return visitor.visitScopeAnnotation(scopingAnnotation);
    }

    @Override public Class<? extends Annotation> getScopeAnnotation() {
      return scopingAnnotation;
    }

    @Override public String toString() {
      return scopingAnnotation.getName();
    }

    @Override public void applyTo(ScopedBindingBuilder scopedBindingBuilder) {
      scopedBindingBuilder.in(scopingAnnotation);
    }
  };
}
 
开发者ID:cgruber,项目名称:guice-old,代码行数:25,代码来源:Scoping.java

示例6: forInstance

import com.google.inject.binder.ScopedBindingBuilder; //导入方法依赖的package包/类
public static Scoping forInstance(final Scope scope) {
  if (scope == Scopes.SINGLETON) {
    return SINGLETON_INSTANCE;
  }

  return new Scoping() {
    @Override public <V> V acceptVisitor(BindingScopingVisitor<V> visitor) {
      return visitor.visitScope(scope);
    }

    @Override public Scope getScopeInstance() {
      return scope;
    }

    @Override public String toString() {
      return scope.toString();
    }

    @Override public void applyTo(ScopedBindingBuilder scopedBindingBuilder) {
      scopedBindingBuilder.in(scope);
    }
  };
}
 
开发者ID:cgruber,项目名称:guice-old,代码行数:24,代码来源:Scoping.java

示例7: forAnnotation

import com.google.inject.binder.ScopedBindingBuilder; //导入方法依赖的package包/类
public static Scoping forAnnotation(final Class<? extends Annotation> scopingAnnotation) {
  if (scopingAnnotation == Singleton.class
      || scopingAnnotation == javax.inject.Singleton.class) {
    return SINGLETON_ANNOTATION;
  }

  return new Scoping() {
    public <V> V acceptVisitor(BindingScopingVisitor<V> visitor) {
      return visitor.visitScopeAnnotation(scopingAnnotation);
    }

    @Override public Class<? extends Annotation> getScopeAnnotation() {
      return scopingAnnotation;
    }

    @Override public String toString() {
      return scopingAnnotation.getName();
    }

    public void applyTo(ScopedBindingBuilder scopedBindingBuilder) {
      scopedBindingBuilder.in(scopingAnnotation);
    }
  };
}
 
开发者ID:utopiazh,项目名称:google-guice,代码行数:25,代码来源:Scoping.java

示例8: forInstance

import com.google.inject.binder.ScopedBindingBuilder; //导入方法依赖的package包/类
public static Scoping forInstance(final Scope scope) {
  if (scope == Scopes.SINGLETON) {
    return SINGLETON_INSTANCE;
  }

  return new Scoping() {
    public <V> V acceptVisitor(BindingScopingVisitor<V> visitor) {
      return visitor.visitScope(scope);
    }

    @Override public Scope getScopeInstance() {
      return scope;
    }

    @Override public String toString() {
      return scope.toString();
    }

    public void applyTo(ScopedBindingBuilder scopedBindingBuilder) {
      scopedBindingBuilder.in(scope);
    }
  };
}
 
开发者ID:utopiazh,项目名称:google-guice,代码行数:24,代码来源:Scoping.java

示例9: bindProvidersInScope

import com.google.inject.binder.ScopedBindingBuilder; //导入方法依赖的package包/类
private void bindProvidersInScope(PrivateBinder privateBinder) {
  ScopedBindingBuilder scoper = privateBinder.bind(providersClass);

  if (scopeAnnotation != null) {
    scoper.in(scopeAnnotation);
  }

  for (EventualProvider<?> p : providers) {
    p.bindFutureProvider(privateBinder);
  }
}
 
开发者ID:immutables,项目名称:miscellaneous,代码行数:12,代码来源:Providers.java

示例10: forAnnotation

import com.google.inject.binder.ScopedBindingBuilder; //导入方法依赖的package包/类
public static Scoping forAnnotation(final Class<? extends Annotation> scopingAnnotation) {
  if (scopingAnnotation == Singleton.class || scopingAnnotation == javax.inject.Singleton.class) {
    return SINGLETON_ANNOTATION;
  }

  return new Scoping() {
    @Override
    public <V> V acceptVisitor(BindingScopingVisitor<V> visitor) {
      return visitor.visitScopeAnnotation(scopingAnnotation);
    }

    @Override
    public Class<? extends Annotation> getScopeAnnotation() {
      return scopingAnnotation;
    }

    @Override
    public String toString() {
      return scopingAnnotation.getName();
    }

    @Override
    public void applyTo(ScopedBindingBuilder scopedBindingBuilder) {
      scopedBindingBuilder.in(scopingAnnotation);
    }
  };
}
 
开发者ID:google,项目名称:guice,代码行数:28,代码来源:Scoping.java

示例11: forInstance

import com.google.inject.binder.ScopedBindingBuilder; //导入方法依赖的package包/类
public static Scoping forInstance(final Scope scope) {
  if (scope == Scopes.SINGLETON) {
    return SINGLETON_INSTANCE;
  } else if (scope == Scopes.NO_SCOPE) {
    return EXPLICITLY_UNSCOPED;
  }

  return new Scoping() {
    @Override
    public <V> V acceptVisitor(BindingScopingVisitor<V> visitor) {
      return visitor.visitScope(scope);
    }

    @Override
    public Scope getScopeInstance() {
      return scope;
    }

    @Override
    public String toString() {
      return scope.toString();
    }

    @Override
    public void applyTo(ScopedBindingBuilder scopedBindingBuilder) {
      scopedBindingBuilder.in(scope);
    }
  };
}
 
开发者ID:google,项目名称:guice,代码行数:30,代码来源:Scoping.java

示例12: applyScope

import com.google.inject.binder.ScopedBindingBuilder; //导入方法依赖的package包/类
private void applyScope(StatisticDescriptor description,
		ScopedBindingBuilder binderBuilder) {
	if(description.getScope() != null && !description.getScope().equals(StatisticScope.PROTOTYPE)) {
		binderBuilder.in(scopes.get(description.getScope()));
	}
}
 
开发者ID:lafourchette,项目名称:solrmeter,代码行数:7,代码来源:StatisticsModule.java

示例13: applyTo

import com.google.inject.binder.ScopedBindingBuilder; //导入方法依赖的package包/类
@Override
public void applyTo(ScopedBindingBuilder scopedBindingBuilder) {
  scopedBindingBuilder.in(Scopes.NO_SCOPE);
}
 
开发者ID:google,项目名称:guice,代码行数:5,代码来源:Scoping.java

示例14: configure

import com.google.inject.binder.ScopedBindingBuilder; //导入方法依赖的package包/类
@Override
void configure(ScopedBindingBuilder sbb) {
  sbb.in(Scopes.SINGLETON);
}
 
开发者ID:google,项目名称:guice,代码行数:5,代码来源:BinderTestSuite.java

示例15: applyTo

import com.google.inject.binder.ScopedBindingBuilder; //导入方法依赖的package包/类
@Override public void applyTo(ScopedBindingBuilder scopedBindingBuilder) {
  scopedBindingBuilder.in(Singleton.class);
}
 
开发者ID:cgruber,项目名称:guice-old,代码行数:4,代码来源:Scoping.java


注:本文中的com.google.inject.binder.ScopedBindingBuilder.in方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。