本文整理汇总了Java中com.google.inject.Binding.acceptScopingVisitor方法的典型用法代码示例。如果您正苦于以下问题:Java Binding.acceptScopingVisitor方法的具体用法?Java Binding.acceptScopingVisitor怎么用?Java Binding.acceptScopingVisitor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.inject.Binding
的用法示例。
在下文中一共展示了Binding.acceptScopingVisitor方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: applyScoping
import com.google.inject.Binding; //导入方法依赖的package包/类
protected void applyScoping(Binding<?> binding, final ScopedBindingBuilder scopedBindingBuilder) {
binding.acceptScopingVisitor(new BindingScopingVisitor<Void>() {
public Void visitEagerSingleton() {
if (scopedBindingBuilder != null) {
scopedBindingBuilder.asEagerSingleton();
}
return null;
}
public Void visitScope(Scope scope) {
scopedBindingBuilder.in(scope);
return null;
}
public Void visitScopeAnnotation(Class<? extends Annotation> scopeAnnotation) {
scopedBindingBuilder.in(scopeAnnotation);
return null;
}
public Void visitNoScoping() {
// do nothing
return null;
}
});
}
示例2: scoped
import com.google.inject.Binding; //导入方法依赖的package包/类
private static String scoped(final Binding<?> binding, final String statement) {
return binding.acceptScopingVisitor(new BindingScopingVisitor<String>() {
@Override
public String visitEagerSingleton() {
if (binding instanceof InstanceBinding<?>) {
return statement;
}
throw new DeguicifierException();
}
@Override
public String visitScope(Scope scope) {
return scopeFieldName(scope) + ".scope(null, " + guicify(statement) + ")";
}
@Override
public String visitScopeAnnotation(Class<? extends Annotation> scopeAnnotation) {
throw new DeguicifierException();
}
@Override
public String visitNoScoping() {
return statement;
}
});
}
示例3: getScopeInstanceOrNull
import com.google.inject.Binding; //导入方法依赖的package包/类
private Scope getScopeInstanceOrNull(Binding<?> binding) {
return binding.acceptScopingVisitor(
new DefaultBindingScopingVisitor<Scope>() {
@Override
public Scope visitScope(Scope scope) {
return scope;
}
});
}
示例4: getScopeInstanceOrNull
import com.google.inject.Binding; //导入方法依赖的package包/类
private Scope getScopeInstanceOrNull(Binding<?> binding) {
return binding.acceptScopingVisitor(new DefaultBindingScopingVisitor<Scope>() {
@Override public Scope visitScope(Scope scope) {
return scope;
}
});
}
示例5: scope
import com.google.inject.Binding; //导入方法依赖的package包/类
private Object scope(Binding<?> binding) {
return binding.acceptScopingVisitor(this);
}