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

se.jbee.inject.bootstrap.ModularBootstrapperBundle 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.bootstrap;

import se.jbee.inject.Type;
import se.jbee.inject.bootstrap.Bootstrapper.ModularBootstrapper;

/**
 * The default utility base class for {@link ModularBundle}s.
 * 
 * @author Jan Bernitt ([email protected])
 */
public abstract class ModularBootstrapperBundle
		implements ModularBundle, ModularBootstrapper {

	private ModularBootstrapper bootstrap;

	@Override
	public void bootstrap( ModularBootstrapper bootstrap ) {
		Bootstrap.nonnullThrowsReentranceException( this.bootstrap );
		this.bootstrap = bootstrap;
		bootstrap();
	}

	@Override
	public void install( Class bundle, M module ) {
		bootstrap.install( bundle, module );
	}

	@Override
	public String toString() {
		Type module = Type.supertype( ModularBundle.class, Type.raw( getClass() ) ).parameter( 0 );
		return "bundle " + getClass().getSimpleName() + "[" + module + "]";
	}

	protected abstract void bootstrap();
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy