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


Java TypeLiteral类代码示例

本文整理汇总了Java中org.glassfish.hk2.api.TypeLiteral的典型用法代码示例。如果您正苦于以下问题:Java TypeLiteral类的具体用法?Java TypeLiteral怎么用?Java TypeLiteral使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: configure

import org.glassfish.hk2.api.TypeLiteral; //导入依赖的package包/类
@Override
public boolean configure(FeatureContext context) {

	context.register(new AbstractBinder() {

		@Override
		protected void configure() {

			Injector injector = ClientGuiceBridgeFeature.getInjector(context.getConfiguration());
			ClientGuiceInjectInjector injectInjector = new ClientGuiceInjectInjector(injector);

			bind(injectInjector).to(new TypeLiteral<InjectionResolver<com.google.inject.Inject>>() {
			});
		}
	});

	return true;
}
 
开发者ID:bootique,项目名称:bootique-jersey-client,代码行数:19,代码来源:ClientGuiceBridgeFeature.java

示例2: setUp

import org.glassfish.hk2.api.TypeLiteral; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    ServiceLocator locator = ServiceLocatorUtilities.createAndPopulateServiceLocator();
    ServiceLocatorUtilities.bind(locator, new AbstractBinder() {

        @Override
        protected void configure() {
            bind(SecurityService.class).to(SecurityService.class);
            bind(accountDao).to(AccountDao.class);
            bind(passwordDao).to(AccountPasswordDao.class);
            bind(userProvider).to(UserProvider.class);
            bind(event).to(new TypeLiteral<Event<SignedInEvent>>() {
            });
        }
    });
    locator.inject(this);
}
 
开发者ID:backpaper0,项目名称:sealion,代码行数:18,代码来源:SecurityServiceTest.java

示例3: configure

import org.glassfish.hk2.api.TypeLiteral; //导入依赖的package包/类
@Override
public boolean configure(FeatureContext context) {
    Configuration configuration = context.getConfiguration();
    if (!configuration.isRegistered(ConfigPropertyResolver.class)) {
        LOGGER.debug("Register ConfigPropertyFeature");
        context.register(ConfigPropertyResolver.class);
        context.register(new AbstractBinder() {
            @Override
            protected void configure() {
                bind(ConfigPropertyResolver.class)
                        .to(new TypeLiteral<InjectionResolver<ConfigProperty>>() {})
                        .in(Singleton.class);
            }
        });
    }
    return true;
}
 
开发者ID:protoxme,项目名称:protox-webapp-archetype,代码行数:18,代码来源:ConfigPropertyFeature.java

示例4: configure

import org.glassfish.hk2.api.TypeLiteral; //导入依赖的package包/类
@Override
public boolean configure(FeatureContext context) {

	// for now only supporting Guice injection to resources

	// TODO: if we want to inject web environment objects back into Guice
	// services or to use JSR-330 annotations in Resources, we need
	// org.glassfish.hk2:guice-bridge integration

	// This feature can inject HK2 ServiceLocator in constructor, and then
	// we can bridge it both ways with Guice

	context.register(new AbstractBinder() {
		@Override
		protected void configure() {
			bind(GuiceInjectInjector.class).to(new TypeLiteral<InjectionResolver<com.google.inject.Inject>>() {
			}).in(Singleton.class);
		}
	});

	return true;
}
 
开发者ID:bootique,项目名称:bootique-jersey,代码行数:23,代码来源:GuiceBridgeFeature.java

示例5: run

import org.glassfish.hk2.api.TypeLiteral; //导入依赖的package包/类
@Override
    public void run(T configuration, Environment environment) {
        final HazelcastSessionConfig hazelcastSessionConfig = getHazelcastSessionConfig(configuration);

        final Class<? extends Factory<SessionsStore>> sessionsStoreFactoryClass = hazelcastSessionConfig.getSessionsStoreFactoryClass();
        environment.jersey().register(new AbstractBinder() {
            @Override
            protected void configure() {
                bindFactory(sessionsStoreFactoryClass).to(SessionsStore.class).in(Singleton.class);
                bind(hazelcastSessionConfig).to(HazelcastSessionConfig.class);
                bind(SessionObjectResolver.class)
                        .to(new TypeLiteral<InjectionResolver<Session>>() {
                        })
                        .in(Singleton.class);
            }
        });
//        environment.lifecycle().manage(new HazelcastInstanceManager(hazelcastInstance));
        environment.jersey().register(SetSessionIdResponseFilter.class);
    }
 
开发者ID:martindow,项目名称:dropwizard-hazelcast-session,代码行数:20,代码来源:HazelcastSessionBundle.java

示例6: configure

import org.glassfish.hk2.api.TypeLiteral; //导入依赖的package包/类
@Override
public boolean configure(FeatureContext context) {
    context.register(new AbstractBinder() {
        @Override
        public void configure() {
            bind(TokenAuthenticator.class)
                    .in(Singleton.class);
            bind(TokenFactory.class)
                    .in(Singleton.class);
            bind(TokenFactoryProvider.class)
                    .to(ValueFactoryProvider.class)
                    .in(Singleton.class);
            bind(TokenParamInjectionResolver.class)
                    .to(new TypeLiteral<InjectionResolver<RobeAuth>>() {
                    })
                    .in(Singleton.class);
        }
    });
    return true;
}
 
开发者ID:robeio,项目名称:robe,代码行数:21,代码来源:TokenFeature.java

示例7: generate

import org.glassfish.hk2.api.TypeLiteral; //导入依赖的package包/类
public Client generate() {
    ClientConfig clientConfig = clientConfigBase != null
            ? new ClientConfig().loadFrom(clientConfigBase)
            : new ClientConfig();
    final List<JerseyConfig.Binder> binders = new ArrayList<>();
    binders.add(binder -> binder.bind(serviceDefinition).to(ServiceDefinition.class).named(SERVICE_DEFINITION_INJECTION));

    JsonConfig jsonConfig = serviceDefinition.getJsonConfig();
    ObjectMapper mapper = jsonConfig.get();
    JacksonJaxbJsonProvider provider = new JacksonJaxbJsonProvider();
    provider.setMapper(mapper);
    clientConfig.register(provider);
    binders.add(binder -> binder.bind(mapper).to(ObjectMapper.class));
    if (! Strings.isNullOrEmpty(clientAppName)) {
        binders.add(binder -> binder.bind(clientAppName).to(String.class).named(ClientNameFilter.CLIENT_APPNAME));
    }
    if (appTokenSupplier != null) {
        binders.add(binder -> binder
                .bind(appTokenSupplier)
                .to(new TypeLiteral<Supplier<String>>() {
                })
                .named(AppTokenClientFilter.APP_TOKEN_SUPPLIER_BIND_NAME)
        );
        clientConfig.register(AppTokenClientFilter.class);
    }

    clientConfig.register(new AbstractBinder() {
        @Override
        protected void configure() {
            binders.forEach(it -> it.addBindings(this));
        }
    });

    return ClientBuilder.newClient(clientConfig);
}
 
开发者ID:code-obos,项目名称:servicebuilder,代码行数:36,代码来源:ClientGenerator.java

示例8: configure

import org.glassfish.hk2.api.TypeLiteral; //导入依赖的package包/类
@Override
protected void configure() {
    bind(new RateLimiterFactoryProvider(requestRateLimiterFactory)).to(RateLimiterFactoryProvider.class);
    bind(RateLimitingFactoryProvider.class).to(ValueFactoryProvider.class).in(Singleton.class);
    bind(RateLimitingFactoryProvider.RateLimitingInjectionResolver.class)
            .to(new TypeLiteral<InjectionResolver<RateLimiting>>() {}).in(Singleton.class);
}
 
开发者ID:mokies,项目名称:ratelimitj,代码行数:8,代码来源:RateLimitBundle.java

示例9: configure

import org.glassfish.hk2.api.TypeLiteral; //导入依赖的package包/类
@Override
protected void configure() {
    bind(TestRateLimitingFactoryProvider.class).to(ValueFactoryProvider.class).in(Singleton.class);
    bind(TestRateLimitingFactoryProvider.TestRateLimitingInjectionResolver.class).to(
            new TypeLiteral<InjectionResolver<RateLimiting>>() {
            }
    ).in(Singleton.class);
}
 
开发者ID:mokies,项目名称:ratelimitj,代码行数:9,代码来源:RateLimit429EnforcerFilterTest.java

示例10: configure

import org.glassfish.hk2.api.TypeLiteral; //导入依赖的package包/类
@Override
protected void configure() {

    bind(JsonParamValueFactoryProvider.class).to(ValueFactoryProvider.class).in(Singleton.class);
    bind(JsonParamValueFactoryProvider.InjectionResolver.class).to(new TypeLiteral<InjectionResolver<JsonParam>>() {
    }).in(Singleton.class);

}
 
开发者ID:protoxme,项目名称:protox-webapp-archetype,代码行数:9,代码来源:JsonParamFeature.java

示例11: configure

import org.glassfish.hk2.api.TypeLiteral; //导入依赖的package包/类
@Override
protected void configure() {
    // Binding naming services
    bind(DefaultMetricNameService.class).to(MetricNameService.class).in(Singleton.class);
    bind(DefaultMetricNameFormatter.class).to(MetricNameFormatter.class).in(Singleton.class);
    bind(CodahaleMetricNameFilter.class).to(MetricNameFilter.class).in(Singleton.class).ranked(MetricNameFilter.DEFAULT_NAME_PRIORITY);
    bindAsContract(TaggedMetricRegistry.class).in(Singleton.class);
    // Bind Metric method handlers
    bind(GaugeAnnotationActivator.class).to(InstanceLifecycleListener.class).in(Singleton.class);
    bind(CachedGaugeAnnotationActivator.class).to(InstanceLifecycleListener.class).in(Singleton.class);
    // Bind Metric  interceptors
    bind(CountedInterceptorFactory.class)
        .to(new TypeLiteral<AnnotatedMethodInterceptorFactory<Counted>>() {})
        .to(new TypeLiteral<AnnotatedConstructorInterceptorFactory<Counted>>() {})
        .in(Singleton.class);
    bind(ExceptionMeteredInterceptorFactory.class)
        .to(new TypeLiteral<AnnotatedMethodInterceptorFactory<ExceptionMetered>>() {})
        .to(new TypeLiteral<AnnotatedConstructorInterceptorFactory<ExceptionMetered>>() {})
        .in(Singleton.class);
    bind(MeteredInterceptorFactory.class)
        .to(new TypeLiteral<AnnotatedMethodInterceptorFactory<Metered>>() {})
        .to(new TypeLiteral<AnnotatedConstructorInterceptorFactory<Metered>>() {})
        .in(Singleton.class);
    bind(TimedInterceptorFactory.class)
        .to(new TypeLiteral<AnnotatedMethodInterceptorFactory<Timed>>() {})
        .to(new TypeLiteral<AnnotatedConstructorInterceptorFactory<Timed>>() {})
        .in(Singleton.class);
}
 
开发者ID:baharclerode,项目名称:dropwizard-hk2,代码行数:29,代码来源:HK2MetricBinder.java

示例12: configure

import org.glassfish.hk2.api.TypeLiteral; //导入依赖的package包/类
@Override
protected void configure() {
    bind(dataSourceFactoryProvider);

    bindFactory(JDBIFactory.class)
            .to(DBI.class)
            .in(Singleton.class);

    bind(JDBIInjectionResolver.class)
            .to(new TypeLiteral<InjectionResolver<InjectDAO>>() {})
            .in(Singleton.class);
}
 
开发者ID:alex-shpak,项目名称:dropwizard-hk2bundle,代码行数:13,代码来源:JDBIBinder.java

示例13: configure

import org.glassfish.hk2.api.TypeLiteral; //导入依赖的package包/类
@Override
protected void configure() {
    bind(profile).to(ProfileFactoryBuilder.class);
    bind(optProfile).to(OptionalProfileFactoryBuilder.class);
    bind(manager).to(ProfileManagerFactoryBuilder.class);

    bind(Pac4JProfileValueFactoryProvider.class).to(ValueFactoryProvider.class).in(Singleton.class);

    bind(ProfileInjectionResolver.class).to(new TypeLiteral<InjectionResolver<Pac4JProfile>>() {
    }).in(Singleton.class);
    bind(ProfileManagerInjectionResolver.class).to(new TypeLiteral<InjectionResolver<Pac4JProfileManager>>() {
    }).in(Singleton.class);
}
 
开发者ID:pac4j,项目名称:jax-rs-pac4j,代码行数:14,代码来源:Pac4JValueFactoryProvider.java

示例14: configure

import org.glassfish.hk2.api.TypeLiteral; //导入依赖的package包/类
/**
 * Configures default binding for dependencies required by {@link JerseyApplicationBase}.
 */
@Override
protected void configure() {
    bind(new LateBoundApplicationResolver())
            .to(ApplicationResolver.class)
            .to(LateBoundApplicationResolver.class);

    bind(new ResourceConfig())
            .to(ResourceConfig.class);

    bindFactory(configContextFactory)
            .to(new TypeLiteral<ConfigContext<ConfigT>>() { })
            .in(Singleton.class);
}
 
开发者ID:joeyb,项目名称:undercarriage,代码行数:17,代码来源:JerseyApplicationBaseBinder.java

示例15: configContextInstanceIsBoundToConfigContextMockConfigAsSingleton

import org.glassfish.hk2.api.TypeLiteral; //导入依赖的package包/类
@Test
public void configContextInstanceIsBoundToConfigContextMockConfigAsSingleton() {
    ConfigContext<MockConfig> configContext1 = serviceLocator.getService(
            new TypeLiteral<ConfigContext<MockConfig>>() { }.getRawType());
    ConfigContext<MockConfig> configContext2 = serviceLocator.getService(
            new TypeLiteral<ConfigContext<MockConfig>>() { }.getRawType());

    assertThat(configContext1)
            .isNotNull()
            .isEqualTo(configContext2);
}
 
开发者ID:joeyb,项目名称:undercarriage,代码行数:12,代码来源:JerseyApplicationBaseBinderTests.java


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