All Downloads are FREE. Search and download functionalities are using the official Maven repository.

se.jbee.inject.bind.AbstractBinderModule Maven / Gradle / Ivy

There is a newer version: 0.6
Show newest version
/*
 *  Copyright (c) 2012, Jan Bernitt 
 *			
 *  Licensed under the Apache License, Version 2.0, http://www.apache.org/licenses/LICENSE-2.0
 */
package se.jbee.inject.bind;

import static se.jbee.inject.Source.source;
import se.jbee.inject.Instance;
import se.jbee.inject.Name;
import se.jbee.inject.Packages;
import se.jbee.inject.Scope;
import se.jbee.inject.Type;
import se.jbee.inject.bind.Binder.InspectBinder;
import se.jbee.inject.bind.Binder.RootBinder;
import se.jbee.inject.bind.Binder.ScopedBinder;
import se.jbee.inject.bind.Binder.TargetedBinder;
import se.jbee.inject.bind.Binder.TypedBinder;
import se.jbee.inject.bind.Binder.TypedElementBinder;
import se.jbee.inject.bootstrap.Bindings;
import se.jbee.inject.bootstrap.Bootstrap;
import se.jbee.inject.bootstrap.Inspect;
import se.jbee.inject.bootstrap.Inspector;
import se.jbee.inject.util.Scoped;

public abstract class AbstractBinderModule {

	private RootBinder binder;

	protected AbstractBinderModule() {
		this( Scoped.APPLICATION );
	}

	protected AbstractBinderModule( Scope inital ) {
		this.binder = Binder.create( null, Inspect.DEFAULT, source( getClass() ), inital );
	}

	protected void init( Bindings bindings, Inspector inspector ) {
		Bootstrap.nonnullThrowsReentranceException( binder.bindings );
		this.binder = binder.into( bindings ).using( inspector ).with( source( getClass() ) );
	}

	public ScopedBinder per( Scope scope ) {
		return binder.per( scope );
	}

	public RootBinder asDefault() {
		return binder.asDefault();
	}

	public TargetedBinder injectingInto( Class target ) {
		return binder.injectingInto( target );
	}

	public TargetedBinder injectingInto( Type target ) {
		return binder.injectingInto( target );
	}

	public TargetedBinder injectingInto( Name name, Class type ) {
		return binder.injectingInto( name, type );
	}

	public TargetedBinder injectingInto( Name name, Type type ) {
		return binder.injectingInto( name, type );
	}

	public TargetedBinder injectingInto( Instance target ) {
		return binder.injectingInto( target );
	}

	public Binder inPackageOf( Class type ) {
		return binder.inPackageOf( type );
	}

	public Binder inSubPackagesOf( Class type ) {
		return binder.inSubPackagesOf( type );
	}

	public Binder inPackageAndSubPackagesOf( Class type ) {
		return binder.inPackageAndSubPackagesOf( type );
	}

	public Binder in( Packages packages ) {
		return binder.in( packages );
	}

	public  TypedBinder bind( Class type ) {
		return binder.bind( type );
	}

	public  TypedElementBinder arraybind( Class type ) {
		return binder.arraybind( type );
	}

	public InspectBinder bind( Inspector inspector ) {
		return binder.bind( inspector );
	}

	public  TypedBinder bind( Instance instance ) {
		return binder.bind( instance );
	}

	public  TypedBinder bind( Name name, Class type ) {
		return binder.bind( name, type );
	}

	public  TypedBinder bind( Name name, Type type ) {
		return binder.bind( name, type );
	}

	public  TypedBinder bind( Type type ) {
		return binder.bind( type );
	}

	public void construct( Class type ) {
		binder.construct( type );
	}

	public void construct( Name name, Class type ) {
		binder.construct( name, type );
	}

	public void construct( Instance instance ) {
		binder.construct( instance );
	}

	public  TypedBinder starbind( Class type ) {
		return binder.starbind( type );
	}

	public  TypedBinder autobind( Type type ) {
		return binder.autobind( type );
	}

	public  TypedBinder autobind( Class type ) {
		return binder.autobind( type );
	}

	public  TypedBinder multibind( Instance instance ) {
		return binder.multibind( instance );
	}

	public  TypedBinder multibind( Type type ) {
		return binder.multibind( type );
	}

	public  TypedBinder multibind( Class type ) {
		return binder.multibind( type );
	}

	public  TypedBinder multibind( Name name, Class type ) {
		return binder.multibind( name, type );
	}

	public  TypedBinder multibind( Name name, Type type ) {
		return binder.multibind( name, type );
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy