Package se.jbee.inject.config

Examples of se.jbee.inject.config.Options


    public <C extends Enum<C>> void install( Class<? extends ModularBundle<C>> bundle,
        final Class<C> property ) {
      if ( !globals.edition.featured( property ) ) {
        return;
      }
      final Options options = globals.options;
      Bootstrap.instance( bundle ).bootstrap( new ModularBootstrapper<C>() {

        @Override
        public void install( Class<? extends Bundle> bundle, C module ) {
          if ( options.isChosen( property, module ) ) { // null is a valid value to define what happens when no configuration is present
            BuildinBootstrapper.this.install( bundle );
          }
        }
      } );
    }
View Full Code Here


  public void thatBundleOfUndefinedConstGotBootstrappedAndOthersNot() {
    assertOptionResolvedToValue( null, "on-generic" );
  }

  private static void assertOptionResolvedToValue( Machine actualOption, String expected ) {
    Options options = Options.STANDARD.chosen( actualOption );
    Injector injector = Bootstrap.injector( ModularBindsBundle.class,
        Globals.STANDARD.options( options ) );
    String[] actual = injector.resolve( dependency( String[].class ) );
    assertThat( actual, is( new String[] { expected } ) );
  }
View Full Code Here

  }

  @Test
  public void thatMultipleOptionChoicesArePossible() {
    Options options = Options.STANDARD.chosen( Choices.A, Choices.D );
    Globals globals = Globals.STANDARD.options( options );
    Injector injector = Bootstrap.injector( RootBundle.class, globals );
    assertEqualSets( new String[] { "A", "D" }, injector.resolve( dependency( String[].class ) ) );
  }
View Full Code Here

TOP

Related Classes of se.jbee.inject.config.Options

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.