Package se.jbee.inject

Examples of se.jbee.inject.Name


      }
      return instanceMethods;
    }

    private <T> void bind( Constructor<T> constructor, Parameter<?>... parameters ) {
      Name name = inspector.nameFor( constructor );
      Class<T> implementation = constructor.getDeclaringClass();
      if ( name.isDefault() ) {
        binder.autobind( implementation ).to( constructor, parameters );
      } else {
        binder.bind( name, implementation ).to( constructor, parameters );
        for ( Type<? super T> st : Type.raw( implementation ).supertypes() ) {
          if ( st.isInterface() ) {
View Full Code Here


  }

  private Parameter<?>[] parametersFor( Type<?>[] types, Annotation[][] annotations ) {
    List<Parameter<?>> res = new ArrayList<Parameter<?>>();
    for ( int i = 0; i < annotations.length; i++ ) {
      Name name = Name.namedBy( namedby, annotations[i] );
      if ( name != Name.DEFAULT ) {
        res.add( Instance.instance( name, types[i] ) );
      }
    }
    return Array.of( res, NO_PARAMETERS );
View Full Code Here

  private static class ConfigurationDependentBindsModule3
      extends BinderModule {

    @Override
    protected void declare() {
      Name answer = named( "answer" );
      ConfigBinder<String> bind = configbind( String.class );
      bind.on( answer, 42 ).to( "Now it is 42" );
      bind.on( answer, 7 ).to( "Now it is 7" );
      bind.onOther( answer, Integer.class ).to( "Default is undefined" );
View Full Code Here

    @Override
    protected void declare() {
      construct( Foo.class );
      injectingInto( Foo.class ).bind( Bar.class ).to( BAR_IN_FOO );
      bind( Bar.class ).to( BAR_EVERYWHERE_ELSE );
      Name special = named( "special" );
      construct( special, Foo.class ); // if we would use a type bind like to(Foo.class) it wouldn't work since we use a Foo that is not created as special Foo so it got the other Bar
      injectingInto( special, Foo.class ).bind( Bar.class ).to( BAR_EVERYWHERE_ELSE );
      Name awesome = named( "awesome" );
      construct( awesome, Foo.class );
      injectingInto( awesome, Foo.class ).bind( Bar.class ).to( BAR_IN_AWESOME_FOO );
      construct( Baz.class );
      TargetedBinder binder = injectingInto( Serializable.class );
      binder.bind( Bar.class ).to( BAR_IN_SERIALIZABLE );
View Full Code Here

      extends BinderModule {

    @Override
    protected void declare() {
      bind( String.class ).to( "foobar" );
      Name special = named( "special" );
      bind( special, String.class ).to( "special" );
      inPackageOf( List.class ).bind( String.class ).to( "list" );
      inPackageOf( List.class ).bind( special, String.class ).to( "special-list" );
    }
View Full Code Here

TOP

Related Classes of se.jbee.inject.Name

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.