本文整理汇总了Java中com.google.inject.Provider类的典型用法代码示例。如果您正苦于以下问题:Java Provider类的具体用法?Java Provider怎么用?Java Provider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Provider类属于com.google.inject包,在下文中一共展示了Provider类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: thisTypeRefImpl
import com.google.inject.Provider; //导入依赖的package包/类
protected Result<TypeRef> thisTypeRefImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final EObject location) throws RuleFailedException {
try {
final RuleApplicationTrace _subtrace_ = newTrace(_trace_);
final Result<TypeRef> _result_ = applyRuleThisTypeRefEObject(G, _subtrace_, location);
addToTrace(_trace_, new Provider<Object>() {
public Object get() {
return ruleName("thisTypeRefEObject") + stringRepForEnv(G) + " |~ " + stringRep(location) + " ~> " + stringRep(_result_.getFirst());
}
});
addAsSubtrace(_trace_, _subtrace_);
return _result_;
} catch (Exception e_applyRuleThisTypeRefEObject) {
thisTypeRefThrowException(ruleName("thisTypeRefEObject") + stringRepForEnv(G) + " |~ " + stringRep(location) + " ~> " + "TypeRef",
THISTYPEREFEOBJECT,
e_applyRuleThisTypeRefEObject, location, new ErrorInformation[] {new ErrorInformation(location)});
return null;
}
}
示例2: substTypeVariablesImpl
import com.google.inject.Provider; //导入依赖的package包/类
protected Result<TypeArgument> substTypeVariablesImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final ComposedTypeRef typeRef) throws RuleFailedException {
try {
final RuleApplicationTrace _subtrace_ = newTrace(_trace_);
final Result<TypeArgument> _result_ = applyRuleSubstTypeVariablesInComposedTypeRef(G, _subtrace_, typeRef);
addToTrace(_trace_, new Provider<Object>() {
public Object get() {
return ruleName("substTypeVariablesInComposedTypeRef") + stringRepForEnv(G) + " |- " + stringRep(typeRef) + " ~> " + stringRep(_result_.getFirst());
}
});
addAsSubtrace(_trace_, _subtrace_);
return _result_;
} catch (Exception e_applyRuleSubstTypeVariablesInComposedTypeRef) {
substTypeVariablesThrowException(ruleName("substTypeVariablesInComposedTypeRef") + stringRepForEnv(G) + " |- " + stringRep(typeRef) + " ~> " + "ComposedTypeRef",
SUBSTTYPEVARIABLESINCOMPOSEDTYPEREF,
e_applyRuleSubstTypeVariablesInComposedTypeRef, typeRef, new ErrorInformation[] {new ErrorInformation(typeRef)});
return null;
}
}
示例3: configureModules
import com.google.inject.Provider; //导入依赖的package包/类
@Override
protected void configureModules() {
super.configureModules();
addModule(new AbstractModule() {
@Override
public void configure() {
bind(IWorldMessageTranslator.class).to(BotFSM.class);
bind(IWorldView.class).to(IVisionWorldView.class);
bind(IVisionWorldView.class).to(ILockableVisionWorldView.class);
bind(ILockableWorldView.class).to(ILockableVisionWorldView.class);
bind(ILockableVisionWorldView.class).to(UT2004SyncLockableWorldView.class);
bind(ComponentDependencies.class).annotatedWith(Names.named(UT2004SyncLockableWorldView.WORLDVIEW_DEPENDENCY)).toProvider(worldViewDependenciesProvider);
bind(IAgent.class).to(IAgent3D.class);
bind(IAgent3D.class).to(IUT2004Bot.class);
bind(IUT2004Bot.class).to(UT2004Bot.class);
if (botControllerClass != null) {
bind(IUT2004BotController.class).to(botControllerClass);
}
bind(UT2004BotParameters.class).toProvider((Provider<? extends UT2004BotParameters>) getAgentParamsProvider());
}
});
}
示例4: subtypeImpl
import com.google.inject.Provider; //导入依赖的package包/类
protected Result<Boolean> subtypeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final TypeTypeRef left, final TypeTypeRef right) throws RuleFailedException {
try {
final RuleApplicationTrace _subtrace_ = newTrace(_trace_);
final Result<Boolean> _result_ = applyRuleSubtypeTypeTypeRef(G, _subtrace_, left, right);
addToTrace(_trace_, new Provider<Object>() {
public Object get() {
return ruleName("subtypeTypeTypeRef") + stringRepForEnv(G) + " |- " + stringRep(left) + " <: " + stringRep(right);
}
});
addAsSubtrace(_trace_, _subtrace_);
return _result_;
} catch (Exception e_applyRuleSubtypeTypeTypeRef) {
subtypeThrowException(ruleName("subtypeTypeTypeRef") + stringRepForEnv(G) + " |- " + stringRep(left) + " <: " + stringRep(right),
SUBTYPETYPETYPEREF,
e_applyRuleSubtypeTypeTypeRef, left, right, new ErrorInformation[] {new ErrorInformation(left), new ErrorInformation(right)});
return null;
}
}
示例5: getProvider
import com.google.inject.Provider; //导入依赖的package包/类
private Provider<?> getProvider(final Class<?> clazz, final BindType bindType) {
Provider<?> provider = new Provider<Object>() {
@Override
public Object get() {
try {
Object instance = null;
if (bindType == BindType.SPY) {
instance = spy(clazz.newInstance());
} else if (bindType == BindType.MOCK) {
instance = mock(clazz);
}
return instance;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
};
return provider;
}
示例6: typeImpl
import com.google.inject.Provider; //导入依赖的package包/类
protected Result<TypeRef> typeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final TEnumLiteral enumLiteral) throws RuleFailedException {
try {
final RuleApplicationTrace _subtrace_ = newTrace(_trace_);
final Result<TypeRef> _result_ = applyRuleTypeTEnumLiteral(G, _subtrace_, enumLiteral);
addToTrace(_trace_, new Provider<Object>() {
public Object get() {
return ruleName("typeTEnumLiteral") + stringRepForEnv(G) + " |- " + stringRep(enumLiteral) + " : " + stringRep(_result_.getFirst());
}
});
addAsSubtrace(_trace_, _subtrace_);
return _result_;
} catch (Exception e_applyRuleTypeTEnumLiteral) {
typeThrowException(ruleName("typeTEnumLiteral") + stringRepForEnv(G) + " |- " + stringRep(enumLiteral) + " : " + "TypeRef",
TYPETENUMLITERAL,
e_applyRuleTypeTEnumLiteral, enumLiteral, new ErrorInformation[] {new ErrorInformation(enumLiteral)});
return null;
}
}
示例7: expectedTypeInImpl
import com.google.inject.Provider; //导入依赖的package包/类
protected Result<TypeRef> expectedTypeInImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final PostfixExpression e, final Expression expression) throws RuleFailedException {
try {
final RuleApplicationTrace _subtrace_ = newTrace(_trace_);
final Result<TypeRef> _result_ = applyRuleExpectedTypeInPostfixExpression(G, _subtrace_, e, expression);
addToTrace(_trace_, new Provider<Object>() {
public Object get() {
return ruleName("expectedTypeInPostfixExpression") + stringRepForEnv(G) + " |- " + stringRep(e) + " |> " + stringRep(expression) + " : " + stringRep(_result_.getFirst());
}
});
addAsSubtrace(_trace_, _subtrace_);
return _result_;
} catch (Exception e_applyRuleExpectedTypeInPostfixExpression) {
expectedTypeInThrowException(ruleName("expectedTypeInPostfixExpression") + stringRepForEnv(G) + " |- " + stringRep(e) + " |> " + stringRep(expression) + " : " + "TypeRef",
EXPECTEDTYPEINPOSTFIXEXPRESSION,
e_applyRuleExpectedTypeInPostfixExpression, e, expression, new ErrorInformation[] {new ErrorInformation(e), new ErrorInformation(expression)});
return null;
}
}
示例8: supertypeImpl
import com.google.inject.Provider; //导入依赖的package包/类
protected Result<Boolean> supertypeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final TypeRef left, final TypeRef right) throws RuleFailedException {
try {
final RuleApplicationTrace _subtrace_ = newTrace(_trace_);
final Result<Boolean> _result_ = applyRuleSupertypeTypeRef(G, _subtrace_, left, right);
addToTrace(_trace_, new Provider<Object>() {
public Object get() {
return ruleName("supertypeTypeRef") + stringRepForEnv(G) + " |- " + stringRep(left) + " :> " + stringRep(right);
}
});
addAsSubtrace(_trace_, _subtrace_);
return _result_;
} catch (Exception e_applyRuleSupertypeTypeRef) {
supertypeThrowException(ruleName("supertypeTypeRef") + stringRepForEnv(G) + " |- " + stringRep(left) + " :> " + stringRep(right),
SUPERTYPETYPEREF,
e_applyRuleSupertypeTypeRef, left, right, new ErrorInformation[] {new ErrorInformation(left), new ErrorInformation(right)});
return null;
}
}
示例9: upperBoundImpl
import com.google.inject.Provider; //导入依赖的package包/类
protected Result<TypeRef> upperBoundImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final ExistentialTypeRef existentialTypeRef) throws RuleFailedException {
try {
final RuleApplicationTrace _subtrace_ = newTrace(_trace_);
final Result<TypeRef> _result_ = applyRuleUpperBoundExistentialTypeRef(G, _subtrace_, existentialTypeRef);
addToTrace(_trace_, new Provider<Object>() {
public Object get() {
return ruleName("upperBoundExistentialTypeRef") + stringRepForEnv(G) + " |~ " + stringRep(existentialTypeRef) + " /\\ " + stringRep(_result_.getFirst());
}
});
addAsSubtrace(_trace_, _subtrace_);
return _result_;
} catch (Exception e_applyRuleUpperBoundExistentialTypeRef) {
upperBoundThrowException(ruleName("upperBoundExistentialTypeRef") + stringRepForEnv(G) + " |~ " + stringRep(existentialTypeRef) + " /\\ " + "TypeRef",
UPPERBOUNDEXISTENTIALTYPEREF,
e_applyRuleUpperBoundExistentialTypeRef, existentialTypeRef, new ErrorInformation[] {new ErrorInformation(existentialTypeRef)});
return null;
}
}
示例10: LeadServiceForTests
import com.google.inject.Provider; //导入依赖的package包/类
@Inject
public LeadServiceForTests(final DoubleLeadService lead) {
super(new Provider<LeadService>() {
@Override
public LeadService get() {
return lead;
}
});
}
示例11: SamlProxySamlTransformationErrorExceptionMapper
import com.google.inject.Provider; //导入依赖的package包/类
@Inject
public SamlProxySamlTransformationErrorExceptionMapper(
Provider<HttpServletRequest> contextProvider,
EventSinkMessageSender eventSinkMessageSender,
LevelLoggerFactory<SamlProxySamlTransformationErrorExceptionMapper> levelLoggerFactory) {
super(contextProvider);
this.eventSinkMessageSender = eventSinkMessageSender;
this.levelLogger = levelLoggerFactory.createLevelLogger(SamlProxySamlTransformationErrorExceptionMapper.class);
}
示例12: provideImportedNamesAdapter
import com.google.inject.Provider; //导入依赖的package包/类
/**
* Provides new instances of the ImportedNamesAdapter, e.g. concrete instances of N4JSImportedNamesAdapter.
*
* @see ImportedNamesAdapter
*/
public Provider<ImportedNamesAdapter> provideImportedNamesAdapter() {
return new Provider<ImportedNamesAdapter>() {
@Override
public ImportedNamesAdapter get() {
return new N4JSImportedNamesAdapter();
}
};
}
示例13: scope
import com.google.inject.Provider; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public <T> Provider scope(Key<T> key, Provider<T> creator) {
synchronized(providers) {
Provider p = providers.get(key);
if (p != null) {
return p;
}
SingletonProvider<T> provider = new SingletonProvider<T>(creator);
providers.put(key, provider);
return provider;
}
}
示例14: provideInternalPkmntcgoLexer
import com.google.inject.Provider; //导入依赖的package包/类
public Provider<? extends InternalPkmntcgoLexer> provideInternalPkmntcgoLexer() {
return LexerProvider.create(InternalPkmntcgoLexer.class);
}