org.ow2.mind.inject.GuiceModuleExtensionHelper Maven / Gradle / Ivy
The newest version!
/**
* Copyright (C) 2010 STMicroelectronics
*
* This file is part of "Mind Compiler" is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see .
*
* Contact: [email protected]
*
* Authors: Matthieu Leclercq
* Contributors:
*/
package org.ow2.mind.inject;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.objectweb.fractal.adl.CompilerError;
import org.objectweb.fractal.adl.error.GenericErrors;
import org.ow2.mind.plugin.ConfigurationElement;
import org.ow2.mind.plugin.PluginManager;
import org.ow2.mind.plugin.util.Assert;
import org.ow2.mind.plugin.util.BooleanEvaluatorHelper;
import com.google.inject.Module;
import com.google.inject.util.Modules;
/**
* Helper class for the Guice Module extension point.
*/
public final class GuiceModuleExtensionHelper {
/** The extension point ID. */
public static final String GUICE_MODULE_EXTENSION_POINT_ID = "org.ow2.mind.plugin.guice-module";
private static final String CLASS = "class";
private static final String ENABLE_WHEN = "enableWhen";
private static final String OVERRIDE = "override";
private static final String COMBINE = "combine";
private static Iterable modules;
private GuiceModuleExtensionHelper() {
}
/**
* Returns the modules that has been registered using the Guice Module
* extension point.
*
* @param pluginManager the pluginManager.
* @param context the compilation context.
* @return the modules that has been registered using the Guice Module
* extension points.
*/
public static synchronized Iterable getModules(
final PluginManager pluginManager, final Map