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


Java Stage.PRODUCTION属性代码示例

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


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

示例1: getGuiceStage

public Stage getGuiceStage(){
	String stageString = System.getProperty(PROPERTY_NAME);
	final Stage stage;
	boolean development = Stage.DEVELOPMENT.name().equals(stageString);
	boolean production = Stage.PRODUCTION.name().equals(stageString);
	if(development || production){
		stage = development ? Stage.DEVELOPMENT : Stage.PRODUCTION;
		logger.warn("using Guice Stage {} from JVM arg -D{}={}", stage, PROPERTY_NAME, stageString);
	}else if(stageString != null){
		stage = Stage.PRODUCTION;
		logger.warn("unrecognized JVM arg value -D{}={}, using Guice Stage {}", PROPERTY_NAME, stageString,
				Stage.PRODUCTION);
	}else{
		stage = Stage.PRODUCTION;
		logger.warn("using default Guice Stage={}", Stage.PRODUCTION);
	}
	return stage;
}
 
开发者ID:hotpads,项目名称:datarouter,代码行数:18,代码来源:GuiceStageFinder.java

示例2: testCorrectStage

public void testCorrectStage() {
  final Stage stage = Stage.PRODUCTION;
  Module module =
      Modules.override(
              new AbstractModule() {
                @Override
                protected void configure() {
                  if (currentStage() != Stage.PRODUCTION) {
                    addError("Wronge stage in overridden module:" + currentStage());
                  }
                }
              })
          .with(
              new AbstractModule() {
                @Override
                protected void configure() {
                  if (currentStage() != Stage.PRODUCTION) {
                    addError("Wronge stage in overriding module:" + currentStage());
                  }
                }
              });
  Guice.createInjector(stage, module);
}
 
开发者ID:google,项目名称:guice,代码行数:23,代码来源:OverrideModuleTest.java

示例3: testCorrectStage

public void testCorrectStage() {
  final Stage stage = Stage.PRODUCTION;
  Module module = Modules.override(new AbstractModule() {
    @Override
    protected void configure() {
      if (currentStage() != Stage.PRODUCTION) {
        addError("Wronge stage in overridden module:" + currentStage());
      }
    }
  }).with(new AbstractModule() {
    @Override
    protected void configure() {
      if (currentStage() != Stage.PRODUCTION) {
        addError("Wronge stage in overriding module:" + currentStage());
      }
    }
  });
  Guice.createInjector(stage, module);
}
 
开发者ID:cgruber,项目名称:guice-old,代码行数:19,代码来源:OverrideModuleTest.java

示例4: getStage

/**
 * Override this method to specify which stage to run Guice in.
 * Default behavior is to look first in user preferences and then
 * in system preferences for node "org/directwebremoting/guice"
 * with a value for key "stage". If not found, the default is
 * Stage.PRODUCTION.
 */
protected Stage getStage()
{
    Stage stage = Stage.PRODUCTION;

    try
    {
        Preferences userNode = Preferences.userNodeForPackage(PACKAGE);
        String userStage = userNode.get(STAGE_KEY, null);
        if (userStage != null)
        {
            stage = Stage.valueOf(userStage);
        }
        else
        {
            Preferences systemNode = Preferences.systemNodeForPackage(PACKAGE);
            String systemStage = systemNode.get(STAGE_KEY, null);
            if (systemStage != null)
            {
                stage = Stage.valueOf(systemStage);
            }
        }
    }
    catch (Exception e)
    {
        // ignore errors reading Preferences
    }

    return stage;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:36,代码来源:DwrGuiceServletContextListener.java

示例5: currentStage

@Override
public Stage currentStage() {
    switch (delegate.currentStage()) {
    case DEVELOPMENT:
        return Stage.DEVELOPMENT;
    case PRODUCTION:
        return Stage.PRODUCTION;
    default:
        throw new UnsupportedOperationException();
    }
}
 
开发者ID:ruediste,项目名称:salta,代码行数:11,代码来源:BinderImpl.java

示例6: isEagerSingleton

/** Returns true if this scope is a singleton that should be loaded eagerly in {@code stage}. */
public boolean isEagerSingleton(Stage stage) {
  if (this == EAGER_SINGLETON) {
    return true;
  }

  if (stage == Stage.PRODUCTION) {
    return this == SINGLETON_ANNOTATION || this == SINGLETON_INSTANCE;
  }

  return false;
}
 
开发者ID:google,项目名称:guice,代码行数:12,代码来源:Scoping.java

示例7: isEagerSingleton

/**
 * Returns true if this scope is a singleton that should be loaded eagerly in {@code stage}.
 */
public boolean isEagerSingleton(Stage stage) {
  if (this == EAGER_SINGLETON) {
    return true;
  }

  if (stage == Stage.PRODUCTION) {
    return this == SINGLETON_ANNOTATION || this == SINGLETON_INSTANCE;
  }

  return false;
}
 
开发者ID:cgruber,项目名称:guice-old,代码行数:14,代码来源:Scoping.java

示例8: stage

protected Stage stage() {
    if (System.getenv("TEST") != null || System.getenv("DEV") != null)
        return Stage.DEVELOPMENT;

    return Stage.PRODUCTION;
}
 
开发者ID:Twister915,项目名称:pl,代码行数:6,代码来源:JPl.java

示例9: HttpServerExample

public HttpServerExample() {
	super(Stage.PRODUCTION, new Module());
}
 
开发者ID:softindex,项目名称:datakernel-examples,代码行数:3,代码来源:HttpServerExample.java

示例10: HttpMultithreadedServerExample

public HttpMultithreadedServerExample() {
	super(Stage.PRODUCTION, new Module());
}
 
开发者ID:softindex,项目名称:datakernel-examples,代码行数:3,代码来源:HttpMultithreadedServerExample.java

示例11: ServerSetupExample

public ServerSetupExample() {
	super(Stage.PRODUCTION, new Module());
}
 
开发者ID:softindex,项目名称:datakernel-examples,代码行数:3,代码来源:ServerSetupExample.java

示例12: RpcServerLauncher

public RpcServerLauncher() {
	super(Stage.PRODUCTION, new RpcServerModule());
}
 
开发者ID:softindex,项目名称:datakernel-examples,代码行数:3,代码来源:RpcServerLauncher.java

示例13: RpcClientLauncher

public RpcClientLauncher() {
	super(Stage.PRODUCTION, new RpcClientModule());
}
 
开发者ID:softindex,项目名称:datakernel-examples,代码行数:3,代码来源:RpcClientLauncher.java

示例14: UIKernelWebAppLauncher

public UIKernelWebAppLauncher() {
	super(Stage.PRODUCTION,
			ServiceGraphModule.defaultInstance(),
			PropertiesConfigModule.ofFile("configs.properties"),
			new UIKernelWebAppModule());
}
 
开发者ID:softindex,项目名称:datakernel-examples,代码行数:6,代码来源:UIKernelWebAppLauncher.java

示例15: HttpHelloWorldLauncher

public HttpHelloWorldLauncher() {
	super(Stage.PRODUCTION, ConfigsModule.create(PropertiesConfig.ofProperties("configs.properties")), new HttpHelloWorldModule());
}
 
开发者ID:softindex,项目名称:datakernel-examples,代码行数:3,代码来源:HttpHelloWorldLauncher.java


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