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


Java Provider类代码示例

本文整理汇总了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;
  }
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:19,代码来源:InternalTypeSystem.java

示例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;
  }
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:19,代码来源:InternalTypeSystem.java

示例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());
		}
		
	});
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:25,代码来源:UT2004BotModule.java

示例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;
  }
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:19,代码来源:InternalTypeSystem.java

示例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;
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:21,代码来源:ExtendTestGuiceModule.java

示例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;
  }
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:19,代码来源:InternalTypeSystem.java

示例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;
  }
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:19,代码来源:InternalTypeSystem.java

示例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;
  }
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:19,代码来源:InternalTypeSystem.java

示例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;
  }
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:19,代码来源:InternalTypeSystem.java

示例10: LeadServiceForTests

import com.google.inject.Provider; //导入依赖的package包/类
@Inject
public LeadServiceForTests(final DoubleLeadService lead) {
    super(new Provider<LeadService>() {
        @Override
        public LeadService get() {
            return lead;
        }
    });
}
 
开发者ID:epam,项目名称:Lagerta,代码行数:10,代码来源:LeadServiceForTests.java

示例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);
}
 
开发者ID:alphagov,项目名称:verify-hub,代码行数:10,代码来源:SamlProxySamlTransformationErrorExceptionMapper.java

示例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();
		}
	};
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:14,代码来源:N4JSRuntimeModule.java

示例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;
	}
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:14,代码来源:AgentScope.java

示例14: provideInternalPkmntcgoLexer

import com.google.inject.Provider; //导入依赖的package包/类
public Provider<? extends InternalPkmntcgoLexer> provideInternalPkmntcgoLexer() {
	return LexerProvider.create(InternalPkmntcgoLexer.class);
}
 
开发者ID:rehne93,项目名称:pokemon-tcgo-deck-generator,代码行数:4,代码来源:AbstractPkmntcgoRuntimeModule.java


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