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


Java InjectionManager.getInstance方法代码示例

本文整理汇总了Java中org.glassfish.jersey.internal.inject.InjectionManager.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java InjectionManager.getInstance方法的具体用法?Java InjectionManager.getInstance怎么用?Java InjectionManager.getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.glassfish.jersey.internal.inject.InjectionManager的用法示例。


在下文中一共展示了InjectionManager.getInstance方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkQuery

import org.glassfish.jersey.internal.inject.InjectionManager; //导入方法依赖的package包/类
/**
 * <p>checkQuery.</p>
 *
 * @param query     a {@link io.ebean.Query} object.
 * @param whitelist a {@link java.util.Set} object.
 * @param blacklist a {@link java.util.Set} object.
 * @param manager   a {@link InjectionManager} object.
 */
public static void checkQuery(Query<?> query, Set<String> whitelist,
                              Set<String> blacklist, InjectionManager manager) {
    ResourceInfo resource = manager.getInstance(ResourceInfo.class);
    Class<?> rc = resource.getResourceClass();
    Set<String> wl = null, bl = null;
    if (rc != null) {
        Filter filter = rc.getAnnotation(Filter.class);

        if (filter != null) {
            if (filter.whitelist().length > 0) {
                wl = Sets.newLinkedHashSet();
                Collections.addAll(wl, filter.whitelist());
            }
            if (filter.blacklist().length > 0) {
                bl = Sets.newLinkedHashSet();
                Collections.addAll(bl, filter.blacklist());
            }
        }
    }

    if (whitelist != null) {
        if (wl == null) {
            wl = Sets.newLinkedHashSet();
        }
        wl.addAll(whitelist);
    }

    if (blacklist != null) {
        if (bl == null) {
            bl = Sets.newLinkedHashSet();
        }
        bl.addAll(blacklist);
    }
    checkQuery((SpiQuery) query, wl, bl, manager.getInstance(Application.Mode.class).isProd());
}
 
开发者ID:icode,项目名称:ameba,代码行数:44,代码来源:EbeanUtils.java

示例2: DefaultServerEndpointConfig

import org.glassfish.jersey.internal.inject.InjectionManager; //导入方法依赖的package包/类
/**
 * <p>Constructor for DefaultServerEndpointConfig.</p>
 *
 * @param manager a manager
 * @param endpointClass  a {@link java.lang.Class} endpoint class.
 * @param webSocketConf  a {@link ameba.websocket.WebSocket} object.
 */
public DefaultServerEndpointConfig(final InjectionManager manager,
                                   Class endpointClass,
                                   final WebSocket webSocketConf) {
    path = webSocketConf.path();
    subprotocols = Arrays.asList(webSocketConf.subprotocols());
    encoders = Lists.newArrayList(webSocketConf.encoders());
    decoders = Lists.newArrayList(webSocketConf.decoders());
    for (Class<? extends Extension> extensionClass : webSocketConf.extensions()) {
        extensions.add(Injections.getOrCreate(manager, extensionClass));
    }
    final WebSocketEndpointProvider provider = manager.getInstance(WebSocketEndpointProvider.class);

    final EndpointMeta endpointMeta = provider.parseMeta(endpointClass, webSocketConf);

    final ServerEndpointConfig.Configurator cfgr =
            Injections.getOrCreate(manager, webSocketConf.configurator());
    serverEndpointConfigurator = new ServerEndpointConfig.Configurator() {

        @Override
        public String getNegotiatedSubprotocol(List<String> supported, List<String> requested) {
            return cfgr.getNegotiatedSubprotocol(supported, requested);
        }

        @Override
        public List<Extension> getNegotiatedExtensions(List<Extension> installed, List<Extension> requested) {
            return cfgr.getNegotiatedExtensions(installed, requested);
        }

        @Override
        public boolean checkOrigin(String originHeaderValue) {
            return cfgr.checkOrigin(originHeaderValue);
        }

        @Override
        public void modifyHandshake(ServerEndpointConfig sec,
                                    HandshakeRequest request, HandshakeResponse response) {
            cfgr.modifyHandshake(sec, request, response);
        }

        @Override
        public <T> T getEndpointInstance(Class<T> eClass) throws InstantiationException {
            if (EndpointDelegate.class.equals(eClass)) {
                return eClass.cast(new EndpointDelegate(endpointMeta));
            }
            return cfgr.getEndpointInstance(eClass);
        }
    };
}
 
开发者ID:icode,项目名称:ameba,代码行数:56,代码来源:DefaultServerEndpointConfig.java


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