Example usage for com.google.common.collect MutableClassToInstanceMap create

List of usage examples for com.google.common.collect MutableClassToInstanceMap create

Introduction

In this page you can find the example usage for com.google.common.collect MutableClassToInstanceMap create.

Prototype

public static <B> MutableClassToInstanceMap<B> create() 

Source Link

Document

Returns a new MutableClassToInstanceMap instance backed by a HashMap using the default initial capacity and load factor.

Usage

From source file:com.clarkparsia.pelletserver.client.KnowledgeBaseImpl.java

public KnowledgeBaseImpl(PelletServer server, URL location, String name) {
    this.server = server;
    this.location = location;
    this.name = name;
    this.services = MutableClassToInstanceMap.create();
}

From source file:org.richfaces.services.ServicesFactoryImpl.java

public void init(Iterable<Module> modules) {
    instances = MutableClassToInstanceMap.create();
    for (Module module : modules) {
        module.configure(this);
    }/*  w ww . j  a v a  2 s . c  o  m*/
    for (Object service : instances.values()) {
        if (service instanceof Initializable) {
            Initializable initializableService = (Initializable) service;
            initializableService.init();
        }
    }
    instances = ImmutableClassToInstanceMap.copyOf(instances);
}

From source file:org.richfaces.application.ServicesFactoryImpl.java

/**
 * Allows to configure and initialize a set of modules
 *//*from  w ww  . ja v  a2s  .com*/
public void init(Iterable<Module> modules) {
    instances = MutableClassToInstanceMap.create();
    for (Module module : modules) {
        module.configure(this);
    }
    for (Object service : instances.values()) {
        if (service instanceof Initializable) {
            Initializable initializableService = (Initializable) service;
            initializableService.init();
        }
    }
    instances = ImmutableClassToInstanceMap.copyOf(instances);
}

From source file:org.openflexo.prefs.FlexoPreferences.java

protected FlexoPreferences(File preferencesFile) {
    super(preferencesFile);
    contextualPreferences = MutableClassToInstanceMap.create();
}

From source file:org.obm.guice.AbstractOverrideModule.java

public AbstractOverrideModule(IMocksControl mocksControl) {
    this.mocksControl = mocksControl;
    this.mockMap = MutableClassToInstanceMap.create();
}

From source file:org.obm.push.resource.ResourcesHolder.java

public ResourcesHolder() {
    resources = MutableClassToInstanceMap.create();
}

From source file:org.tensorics.core.commons.options.ImmutableOptionRegistry.java

private <T1 extends Option<T1>> ImmutableOptionRegistry(Collection<T> options) {
    /*//from   ww  w . j  ava2  s . c  o  m
     * we first have to create a mutable map, because the collection might contain options of the same class, where
     * later ones will override previous ones. This would not be allowed by the builder of the immutable map.
     */
    ClassToInstanceMap<T> mutableOptions = MutableClassToInstanceMap.create();
    addToMap(mutableOptions, options);
    this.options = ImmutableClassToInstanceMap.copyOf(mutableOptions);
}

From source file:org.obm.servlet.filter.resource.ResourcesHolder.java

public ResourcesHolder() {
    resources = MutableClassToInstanceMap.create();
    lifo = Queues.newArrayDeque();
}

From source file:saiba.bml.core.BehaviourBlock.java

public BehaviourBlock(BMLBehaviorAttributeExtension... bmlBehaviorAttributeExtensions) {
    this.bmlBehaviorAttributeExtensions = MutableClassToInstanceMap.create();
    for (BMLBehaviorAttributeExtension ext : bmlBehaviorAttributeExtensions) {
        this.bmlBehaviorAttributeExtensions.put(ext.getClass(), ext);
    }//from  ww w.jav a 2 s  .c  o  m
    requiredBlocks = new ArrayList<RequiredBlock>();
    constraintBlocks = new ArrayList<ConstraintBlock>();
    behaviours = new ArrayList<Behaviour>();
}

From source file:com.google.devtools.build.lib.skyframe.BuildConfigurationFunction.java

@Override
public SkyValue compute(SkyKey skyKey, Environment env)
        throws InterruptedException, BuildConfigurationFunctionException {
    BuildConfigurationValue.Key key = (BuildConfigurationValue.Key) skyKey.argument();
    Set<Fragment> fragments;
    try {//from  w ww  . ja v  a  2s.  co  m
        fragments = getConfigurationFragments(key, env);
    } catch (InvalidConfigurationException e) {
        throw new BuildConfigurationFunctionException(e);
    }
    if (fragments == null) {
        return null;
    }

    ClassToInstanceMap<Fragment> fragmentsMap = MutableClassToInstanceMap.create();
    for (Fragment fragment : fragments) {
        fragmentsMap.put(fragment.getClass(), fragment);
    }

    BuildConfiguration config = new BuildConfiguration(directories, fragmentsMap, key.getBuildOptions(),
            !key.actionsEnabled());
    // Unlike static configurations, dynamic configurations don't need to embed transition logic
    // within the configuration itself. However we still use this interface to provide a mapping
    // between Transition types (e.g. HOST) and the dynamic transitions that apply those
    // transitions. Once static configurations are cleaned out we won't need this interface
    // any more (all the centralized logic that maintains the transition logic can be distributed
    // to the actual rule code that uses it).
    config.setConfigurationTransitions(collectionFactory.getDynamicTransitionLogic(config));

    return new BuildConfigurationValue(config);
}