当前位置: 首页>>代码示例>>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;未经允许,请勿转载。