當前位置: 首頁>>代碼示例>>Java>>正文


Java Instance.isUnsatisfied方法代碼示例

本文整理匯總了Java中javax.enterprise.inject.Instance.isUnsatisfied方法的典型用法代碼示例。如果您正苦於以下問題:Java Instance.isUnsatisfied方法的具體用法?Java Instance.isUnsatisfied怎麽用?Java Instance.isUnsatisfied使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.enterprise.inject.Instance的用法示例。


在下文中一共展示了Instance.isUnsatisfied方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: PreferenceStoreImpl

import javax.enterprise.inject.Instance; //導入方法依賴的package包/類
@Inject
public PreferenceStoreImpl(final PreferenceStorage storage,
                           final PreferenceScopeFactory scopeFactory,
                           @Customizable final PreferenceScopeResolutionStrategy defaultScopeResolutionStrategy,
                           final Instance<PreferenceScopeResolutionStrategy> preferenceScopeResolutionStrategy,
                           final InjectionPoint ip) {
    this.storage = storage;
    this.scopeFactory = scopeFactory;

    if (preferenceScopeResolutionStrategy.isUnsatisfied()) {
        if (ip != null) {
            String componentKey = null;
            Annotation annotation = ip.getAnnotated().getAnnotation(ComponentKey.class);
            if (annotation != null) {
                componentKey = ((ComponentKey) annotation).value();
            }

            this.defaultScopeResolutionStrategy = new DefaultPreferenceScopeResolutionStrategy(scopeFactory,
                                                                                               componentKey);
        } else {
            this.defaultScopeResolutionStrategy = defaultScopeResolutionStrategy;
        }
    } else {
        this.defaultScopeResolutionStrategy = preferenceScopeResolutionStrategy.get();
    }
}
 
開發者ID:kiegroup,項目名稱:appformer,代碼行數:27,代碼來源:PreferenceStoreImpl.java

示例2: initialize

import javax.enterprise.inject.Instance; //導入方法依賴的package包/類
@PostConstruct
protected void initialize() {
    log.debug("initializing AuthenticationService");

    final String prov = configurationService.getStringConfiguration("user.auth.provider", DEFAULT_AUTH_PROVIDER_NAMED);

    Instance<AuthenticationProvider> selected = CDIUtils.selectNamed(providers, prov);
    if (selected.isAmbiguous()) {
        authenticationProvider = selected.iterator().next();
        log.error("multiple candidates for AuthenticationProvider '{}' found. Chose randomly!", prov);
    } else if (selected.isUnsatisfied()) {
        log.error("no candidate for AuthenticationProvider '{}' found, falling back to default", prov);
        authenticationProvider = CDIUtils.selectNamed(providers, DEFAULT_AUTH_PROVIDER_NAMED).iterator().next();
    } else {
        authenticationProvider = selected.get();
    }
}
 
開發者ID:apache,項目名稱:marmotta,代碼行數:18,代碼來源:AuthenticationServiceImpl.java

示例3: createInstanceFactory

import javax.enterprise.inject.Instance; //導入方法依賴的package包/類
@Override
public <T> InstanceFactory<T> createInstanceFactory(Class<T> clazz) throws NoSuchMethodException {
    LOGGER.fine("createInstanceFactory: " + clazz);
    Instance<T> inst = CDI.current().select(clazz);
    if (inst.isUnsatisfied() || inst.isAmbiguous()) {
        return DefaultClassIntrospector.INSTANCE.createInstanceFactory(clazz);
    } else {
        return new CdiInstanceFactory<>(inst);
    }
}
 
開發者ID:shamoh,項目名稱:standalone-javax-mvc,代碼行數:11,代碼來源:CdiClassIntrospecter.java

示例4: ESBMessageAdminServiceClient

import javax.enterprise.inject.Instance; //導入方法依賴的package包/類
/**
 * An {@literal @}{@link javax.inject.Inject}able constructor that allows injecting the service client via CDI. The
 * {@code esbMessageAdminContext} must be available as a String with the {@literal @}{@link javax.inject.Named} qualifier of
 * "esbMessageAdminContext".
 *
 * @param esbMessageAdminContext The context of the application or service. For example if an API call to this service
 *         is {@code "http://esbmessageadmin.esbtools.org/api/persist"} then you should pass {@code "http://esbmessageadmin.esbtools.org"}
 *         as the esbMessageAdminContext parameter.
 * @param mapper An parameterized {@link javax.enterprise.inject.Instance} so that a bean may be optionally bound
 *         to {@link com.fasterxml.jackson.databind.ObjectMapper}. If none is explicitly bound the default will be
 *         used: {@link #DEFAULT_OBJECT_MAPPER}.
 */
@Inject
public ESBMessageAdminServiceClient(CloseableHttpClient httpClient, @Named("esbMessageAdminContext") String esbMessageAdminContext,
                           Instance<ObjectMapper> mapper) {
    this.httpClient = httpClient;
    this.esbMessageAdminContext = esbMessageAdminContext.replaceAll("/+$", "");

    if (mapper.isUnsatisfied()) {
        this.mapper = DEFAULT_OBJECT_MAPPER;
    } else {
        this.mapper = mapper.get();
    }
}
 
開發者ID:esbtools,項目名稱:esb-message-admin,代碼行數:25,代碼來源:ESBMessageAdminServiceClient.java

示例5: loadFromCache

import javax.enterprise.inject.Instance; //導入方法依賴的package包/類
/**
 * Get CDI instance messageController from cache
 * @param topic
 * @return 
 */
public JsTopicMessageController loadFromCache(String topic) {
	if(null == topic) {
		return null;
	}
	if(messageControllers.containsKey(topic)) {
		Instance<? extends JsTopicMessageController> instances = getInstances(messageControllers.get(topic));
		if(!instances.isUnsatisfied()) {
			return instances.get();
		}
	}
	return null;
}
 
開發者ID:ocelotds,項目名稱:ocelot,代碼行數:18,代碼來源:MessageControllerCache.java

示例6: getJsTopicMessageControllerFromJsTopicControl

import javax.enterprise.inject.Instance; //導入方法依賴的package包/類
/**
 * Get jstopic message controller from JsTopicControl
 * @param topic
 * @return 
 */
JsTopicMessageController getJsTopicMessageControllerFromJsTopicControl(String topic) {
	logger.debug("Looking for messageController for topic '{}' from JsTopicControl annotation", topic);
	Instance<JsTopicMessageController<?>> select = topicMessageController.select(new JsTopicCtrlAnnotationLiteral(topic));
	if(!select.isUnsatisfied()) {
		logger.debug("Found messageController for topic '{}' from JsTopicControl annotation", topic);
		return select.get();
	}
	return null;
}
 
開發者ID:ocelotds,項目名稱:ocelot,代碼行數:15,代碼來源:MessageControllerManager.java

示例7: getJsTopicMessageControllerFromJsTopicControls

import javax.enterprise.inject.Instance; //導入方法依賴的package包/類
/**
 * without jdk8, @Repeatable doesn't work, so we use @JsTopicControls annotation and parse it
 * @param topic
 * @return 
 */
JsTopicMessageController getJsTopicMessageControllerFromJsTopicControls(String topic) {
	logger.debug("Looking for messageController for topic '{}' from JsTopicControls annotation", topic);
	Instance<JsTopicMessageController<?>> select = topicMessageController.select(new JsTopicCtrlsAnnotationLiteral());
	if(select.isUnsatisfied()) {
		return null;
	}
	return getJsTopicMessageControllerFromIterable(topic, select);
}
 
開發者ID:ocelotds,項目名稱:ocelot,代碼行數:14,代碼來源:MessageControllerManager.java

示例8: checkAccessTopicFromJsTopicControls

import javax.enterprise.inject.Instance; //導入方法依賴的package包/類
/**
 * Check if specific access control is allowed
 * @param ctx
 * @param topic
 * @return true if at least one specific topicAccessControl exist
 * @throws IllegalAccessException 
 */
boolean checkAccessTopicFromJsTopicControls(UserContext ctx, String topic) throws IllegalAccessException {
	logger.debug("Looking for accessController for topic '{}' from JsTopicControls annotation", topic);
	Instance<JsTopicAccessController> select = topicAccessController.select(new JsTopicCtrlsAnnotationLiteral());
	if(select.isUnsatisfied()) {
		return false;
	}
	return checkAccessTopicFromJsTopicAccessControllers(ctx, topic, select);
}
 
開發者ID:ocelotds,項目名稱:ocelot,代碼行數:16,代碼來源:TopicAccessManager.java

示例9: execute

import javax.enterprise.inject.Instance; //導入方法依賴的package包/類
public void execute(JobExecutionContext context) throws JobExecutionException {
	Instance<? extends Job> job = jobInstance.select(context.getJobDetail().getJobClass());

	if (job.isAmbiguous())
		throw new IllegalStateException("Cannot produce job: ambiguous instance");

	if (job.isUnsatisfied())
		throw new IllegalStateException("Cannot produce job: unsatisfied instance");

	job.get().execute(context);
}
 
開發者ID:GluuFederation,項目名稱:oxCore,代碼行數:12,代碼來源:JobExecutionDelegate.java

示例10: resolve

import javax.enterprise.inject.Instance; //導入方法依賴的package包/類
private QueryExecutor resolve(
        Instance<QueryExecutor> executorsByTechnology,
        String technology) throws RuntimeException {
    if (executorsByTechnology.isAmbiguous()) {
        throw new RuntimeException(
                "More then one executors defined for technology: "
                + technology);
    } else if (executorsByTechnology.isUnsatisfied()) {
        throw new RuntimeException(
                "No executor defined for technology: " + technology);
    } else {
        return executorsByTechnology.get();
    }
}
 
開發者ID:etecture,項目名稱:dynamic-repositories,代碼行數:15,代碼來源:QueryExecutors.java

示例11: get

import javax.enterprise.inject.Instance; //導入方法依賴的package包/類
private <T> T get(Class<? extends T> type, Supplier<T> supplier) {
	Instance<? extends T> instance = CDI.current().select(type);

	return instance.isUnsatisfied() ? supplier.get() : instance.get();
}
 
開發者ID:ljtfreitas,項目名稱:java-restify,代碼行數:6,代碼來源:RestifyProxyCdiBeanFactory.java


注:本文中的javax.enterprise.inject.Instance.isUnsatisfied方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。