本文整理汇总了Java中com.google.inject.util.Modules.EMPTY_MODULE属性的典型用法代码示例。如果您正苦于以下问题:Java Modules.EMPTY_MODULE属性的具体用法?Java Modules.EMPTY_MODULE怎么用?Java Modules.EMPTY_MODULE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.google.inject.util.Modules
的用法示例。
在下文中一共展示了Modules.EMPTY_MODULE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildModule
public Module buildModule(ServerConfig serverConfig) {
if (enabled) {
Preconditions.checkNotNull(name);
Preconditions.checkNotNull(defaultServiceUrl);
Preconditions.checkNotNull(healthCheckUrl);
Preconditions.checkNotNull(dataCenter);
Properties properties = new Properties();
properties.setProperty("eureka.name", name);
properties.setProperty("eureka.serviceUrl.default", defaultServiceUrl.toString());
properties.setProperty("eureka.healthCheckUrl", healthCheckUrl);
properties.setProperty("eureka.datacenter", dataCenter == DataCenter.LOCAL ? "local" : "cloud");
properties.setProperty("eureka.port", String.valueOf(serverConfig.getPort()));
properties.setProperty("eureka.vipAddress", vipAddress != null ? vipAddress : name);
properties.setProperty("eureka.statusPageUrl", healthCheckUrl);
return new EurekaModule(properties);
}
return Modules.EMPTY_MODULE;
}
示例2: getRuntimeModule
private static Module getRuntimeModule(String transport, String host, int port, Properties joynrConfig) {
Module runtimeModule;
if (transport != null) {
if (transport.contains("websocketcc")) {
configureWebSocket(host, port, joynrConfig);
runtimeModule = new CCWebSocketRuntimeModule();
} else if (transport.contains("websocket")) {
configureWebSocket(host, port, joynrConfig);
runtimeModule = new LibjoynrWebSocketRuntimeModule();
} else {
runtimeModule = new CCInProcessRuntimeModule();
}
Module backendTransportModules = Modules.EMPTY_MODULE;
if (transport.contains("http")) {
backendTransportModules = Modules.combine(backendTransportModules, new AtmosphereMessagingModule());
}
if (transport.contains("mqtt")) {
configureMqtt(joynrConfig);
backendTransportModules = Modules.combine(backendTransportModules, new MqttPahoModule());
}
return Modules.override(runtimeModule).with(backendTransportModules);
}
return Modules.override(new CCInProcessRuntimeModule()).with(new MqttPahoModule());
}
示例3: forModule
/** Returns a module which creates bindings for provider methods from the given module. */
static Module forModule(Module module) {
// avoid infinite recursion, since installing a module always installs itself
if (module instanceof CheckedProviderMethodsModule) {
return Modules.EMPTY_MODULE;
}
return new CheckedProviderMethodsModule(module);
}
示例4: forObject
private static Module forObject(
Object object, boolean skipFastClassGeneration, ModuleAnnotatedMethodScanner scanner) {
// avoid infinite recursion, since installing a module always installs itself
if (object instanceof ProviderMethodsModule) {
return Modules.EMPTY_MODULE;
}
return new ProviderMethodsModule(object, skipFastClassGeneration, scanner);
}
示例5: forModule
/**
* Returns a module which creates bindings for provider methods from the given module.
*/
static Module forModule(Module module) {
// avoid infinite recursion, since installing a module always installs itself
if (module instanceof CheckedProviderMethodsModule) {
return Modules.EMPTY_MODULE;
}
return new CheckedProviderMethodsModule(module);
}
示例6: forObject
/**
* Returns a module which creates bindings for provider methods from the given object.
* This is useful notably for <a href="http://code.google.com/p/google-gin/">GIN</a>
*/
public static Module forObject(Object object) {
// avoid infinite recursion, since installing a module always installs itself
if (object instanceof ProviderMethodsModule) {
return Modules.EMPTY_MODULE;
}
return new ProviderMethodsModule(object);
}
示例7: getRuntimeModule
private static Module getRuntimeModule(String transport, String host, int port, Properties joynrConfig) {
Module runtimeModule;
if (transport != null) {
if (transport.contains("websocket")) {
joynrConfig.setProperty(WebsocketModule.PROPERTY_WEBSOCKET_MESSAGING_HOST, host);
joynrConfig.setProperty(WebsocketModule.PROPERTY_WEBSOCKET_MESSAGING_PORT, "" + port);
joynrConfig.setProperty(WebsocketModule.PROPERTY_WEBSOCKET_MESSAGING_PROTOCOL, "ws");
joynrConfig.setProperty(WebsocketModule.PROPERTY_WEBSOCKET_MESSAGING_PATH, "");
runtimeModule = new LibjoynrWebSocketRuntimeModule();
} else {
runtimeModule = new CCInProcessRuntimeModule();
}
Module backendTransportModules = Modules.EMPTY_MODULE;
if (transport.contains("http")) {
backendTransportModules = Modules.combine(backendTransportModules, new AtmosphereMessagingModule());
}
if (transport.contains("mqtt")) {
joynrConfig.put("joynr.messaging.mqtt.brokerUri", "tcp://localhost:1883");
joynrConfig.put(MessagingPropertyKeys.PROPERTY_MESSAGING_PRIMARYGLOBALTRANSPORT, "mqtt");
backendTransportModules = Modules.combine(backendTransportModules, new MqttPahoModule());
}
return Modules.override(runtimeModule).with(backendTransportModules);
}
return Modules.override(new CCInProcessRuntimeModule()).with(new MqttPahoModule());
}
示例8: getRuntimeModule
private static Module getRuntimeModule(String[] args, Properties joynrConfig) {
Module runtimeModule;
if (args.length > 1) {
String transport = args[1].toLowerCase();
if (transport.contains("websocketcc")) {
configureWebSocket(joynrConfig);
runtimeModule = new CCWebSocketRuntimeModule();
} else if (transport.contains("websocket")) {
configureWebSocket(joynrConfig);
runtimeModule = new LibjoynrWebSocketRuntimeModule();
} else {
runtimeModule = new CCInProcessRuntimeModule();
}
Module backendTransportModules = Modules.EMPTY_MODULE;
if (transport.contains("http")) {
LOG.info("Configuring HTTP...");
backendTransportModules = Modules.combine(backendTransportModules, new AtmosphereMessagingModule());
}
if (transport.contains("mqtt")) {
LOG.info("Configuring MQTT...");
joynrConfig.put(MessagingPropertyKeys.PROPERTY_MESSAGING_PRIMARYGLOBALTRANSPORT, "mqtt");
backendTransportModules = Modules.combine(backendTransportModules, new MqttPahoModule());
}
return Modules.override(runtimeModule).with(backendTransportModules);
}
return Modules.override(new CCInProcessRuntimeModule()).with(new AtmosphereMessagingModule());
}
示例9: getRuntimeModule
private static Module getRuntimeModule(Properties joynrConfig) {
LOG.info("getRuntimeModule: Entering");
Module runtimeModule;
String transport = System.getProperty("transport");
if (transport == null) {
throw new IllegalArgumentException("property \"transport\" not set");
}
LOG.info("getRuntimeModule: transport = " + transport);
if (transport.contains("websocket")) {
LOG.info("getRuntimeModule: websocket host = "
+ joynrConfig.getProperty(WebsocketModule.PROPERTY_WEBSOCKET_MESSAGING_HOST));
LOG.info("getRuntimeModule: websocket port = "
+ joynrConfig.getProperty(WebsocketModule.PROPERTY_WEBSOCKET_MESSAGING_PORT));
LOG.info("getRuntimeModule: websocket protocol = "
+ joynrConfig.getProperty(WebsocketModule.PROPERTY_WEBSOCKET_MESSAGING_PROTOCOL));
LOG.info("getRuntimeModule: websocket path = "
+ joynrConfig.getProperty(WebsocketModule.PROPERTY_WEBSOCKET_MESSAGING_PATH));
LOG.info("getRuntimeModule: selecting LibjoynrWebSocketRuntimeModule");
runtimeModule = new LibjoynrWebSocketRuntimeModule();
} else {
LOG.info("getRuntimeModule: selecting CCInProcessRuntimeModule");
runtimeModule = new CCInProcessRuntimeModule();
}
Module backendTransportModules = Modules.EMPTY_MODULE;
if (transport.contains("http")) {
LOG.info("getRuntimeModule: using AtmosphereMessagingModule");
backendTransportModules = Modules.combine(backendTransportModules, new AtmosphereMessagingModule());
}
if (transport.contains("mqtt")) {
LOG.info("getRuntimeModule: using MqttPahoModule");
joynrConfig.put(MessagingPropertyKeys.PROPERTY_MESSAGING_PRIMARYGLOBALTRANSPORT, "mqtt");
backendTransportModules = Modules.combine(backendTransportModules, new MqttPahoModule());
}
LOG.info("getRuntimeModule: Leaving");
return Modules.override(runtimeModule).with(backendTransportModules);
}
示例10: getRuntimeModule
private static Module getRuntimeModule(Properties joynrConfig) {
Module runtimeModule;
Module backendTransportModules = Modules.EMPTY_MODULE;
if (invocationParameters.getRuntimeMode() == RuntimeConfig.WEBSOCKET) {
joynrConfig.setProperty(WebsocketModule.PROPERTY_WEBSOCKET_MESSAGING_HOST, invocationParameters.getCcHost());
joynrConfig.setProperty(WebsocketModule.PROPERTY_WEBSOCKET_MESSAGING_PORT, invocationParameters.getCcPort());
joynrConfig.setProperty(WebsocketModule.PROPERTY_WEBSOCKET_MESSAGING_PROTOCOL, "ws");
joynrConfig.setProperty(WebsocketModule.PROPERTY_WEBSOCKET_MESSAGING_PATH, "");
joynrConfig.setProperty(MessagingPropertyKeys.PERSISTENCE_FILE, STATIC_PERSISTENCE_FILE);
runtimeModule = new LibjoynrWebSocketRuntimeModule();
} else {
runtimeModule = new CCInProcessRuntimeModule();
if (invocationParameters.getBackendTransportMode() == BackendConfig.MQTT) {
joynrConfig.put("joynr.messaging.mqtt.brokerUri", invocationParameters.getMqttBrokerUri());
joynrConfig.put(MessagingPropertyKeys.PROPERTY_MESSAGING_PRIMARYGLOBALTRANSPORT, "mqtt");
backendTransportModules = Modules.combine(backendTransportModules, new MqttPahoModule());
} else {
// HTTP
backendTransportModules = Modules.combine(backendTransportModules, new AtmosphereMessagingModule());
}
}
return Modules.override(runtimeModule).with(backendTransportModules);
}
示例11: getOverrides
protected Module getOverrides() {
return Modules.EMPTY_MODULE;
}
示例12: newConfigModule
@Override
public Module newConfigModule() {
return Modules.EMPTY_MODULE;
}
示例13: moduleFor
private Module moduleFor(Class<?> spec) {
InjectWith moduleDef = spec.getAnnotation(InjectWith.class);
return moduleDef == null ? Modules.EMPTY_MODULE
: instantiateModule(moduleDef);
}
示例14: getChildServletModule
/**
* Subclasses should override with a module that configures the servlets they are testing.
*
* @return A module used in the creation of the servlet container's child injector.
*/
protected Module getChildServletModule() {
return Modules.EMPTY_MODULE;
}
示例15: asModule
/**
* Returns a module that, when installed, will scan all modules for methods with the annotations
* {@literal @}{@link ProvidesIntoMap}, {@literal @}{@link ProvidesIntoSet}, and
* {@literal @}{@link ProvidesIntoOptional}.
*
* <p>This is a convenience method, equivalent to doing {@code
* binder().scanModulesForAnnotatedMethods(MultibindingsScanner.scanner())}.
*
* @deprecated This functionality is now installed by default. All references/installations can be
* eliminated.
*/
@Deprecated
public static Module asModule() {
return Modules.EMPTY_MODULE;
}