當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。