Example usage for org.apache.commons.collections.keyvalue MultiKey MultiKey

List of usage examples for org.apache.commons.collections.keyvalue MultiKey MultiKey

Introduction

In this page you can find the example usage for org.apache.commons.collections.keyvalue MultiKey MultiKey.

Prototype

public MultiKey(Object[] keys, boolean makeClone) 

Source Link

Document

Constructor taking an array of keys, optionally choosing whether to clone.

Usage

From source file:MultiKeyExampleV2.java

public static void main(String args[]) {

    codeAndLangToText = new HashMap();
    addMultiKeyAndValue("en", "GM", "Good Morning");
    addMultiKeyAndValue("en", "GE", "Good Evening");
    addMultiKeyAndValue("en", "GN", "Good Night");
    addMultiKeyAndValue("de", "GM", "Guten Morgen");
    addMultiKeyAndValue("de", "GE", "Guten Abend");
    addMultiKeyAndValue("de", "GN", "Guten Nacht");

    System.err.println("Good Evening in English: " + codeAndLangToText.get(new MultiKey("en", "GE")));
    System.err.println("Good Night in German: " + codeAndLangToText.get(new MultiKey("de", "GN")));
}

From source file:MultiKeyExampleV2.java

private static void addMultiKeyAndValue(Object key1, Object key2, Object value) {

    MultiKey key = new MultiKey(key1, key2);
    codeAndLangToText.put(key, value);/*from w  w w  .j  a va2 s . co  m*/
}

From source file:com.netflix.http4.NFHttpClientFactory.java

public static NFHttpClient getNFHttpClient(String host, int port) {
    MultiKey mk = new MultiKey(host, port);
    NFHttpClient client = clientMap.get(mk);
    if (client == null) {
        client = new NFHttpClient(host, port);
        clientMap.put(mk, client);/*from   w  w  w.  j  a v a  2 s.c  o  m*/
    }
    return client;
}

From source file:com.bstek.dorado.core.resource.GlobalResourceBundleManagerSupport.java

public ResourceBundle getBundle(String bundleName, Locale locale) throws Exception {
    Object cacheKey = new MultiKey(bundleName, locale);
    synchronized (cache) {
        Element element = cache.get(cacheKey);
        if (element == null) {
            ResourceBundle bundle = doGetBundle(bundleName, locale);
            element = new Element(cacheKey, bundle);
            cache.put(element);//www.  j a v  a  2  s . co m
        }
        return (ResourceBundle) element.getObjectValue();
    }
}

From source file:com.nextep.datadesigner.gui.service.GUIService.java

/**
 * Registers a navigator model. This method attaches the navigator to its model for the UI layer
 * to be able to retrieve the navigator given the model object.
 * //ww  w .  j av a2  s. c o m
 * @param navigator
 */
public static synchronized void registerNavigator(INavigatorConnector navigator, Tree t) {
    // TODO Beurk: this to avoid registering reference navigators
    if (!("com.nextep.datadesigner.vcs.gui.navigators.ReferenceNavigator"
            .equals(navigator.getClass().getName()))) {
        modelNavigatorsMap.put(new MultiKey(navigator.getModel(), t), navigator);
        modelNavigatorsMap.put(new MultiKey(navigator.getModel(), null), navigator);
    }
}

From source file:com.nextep.designer.sqlgen.helpers.ColumnsSorter.java

public void addColumn(IBasicColumn column, short position) {
    columns.add(new MultiKey(column, (int) position));
}

From source file:com.nextep.designer.sqlgen.helpers.ColumnsSorter.java

public void addColumn(IBasicColumn column, int position) {
    columns.add(new MultiKey(column, position));
}

From source file:com.nextep.datadesigner.gui.service.GUIService.java

/**
 * Unregisters this navigator.//from w w w  . j  ava  2s .co  m
 * 
 * @param navigator
 */
public static synchronized void unregisterNavigator(INavigatorConnector navigator, Tree t) {
    modelNavigatorsMap.remove(new MultiKey(navigator.getModel(), t));
}

From source file:com.nextep.datadesigner.gui.service.GUIService.java

/**
 * Retrieves the navigator of the given object model.
 * //from w ww  .j a v  a  2 s.  co m
 * @param model model object to retrieve the navigator of
 * @return the corresponding navigator, or <code>null</code> if none
 */
public static INavigatorConnector getNavigator(Object model, Tree t) {
    return modelNavigatorsMap.get(new MultiKey(model, t));
}

From source file:com.bstek.dorado.data.method.MethodAutoMatchingUtils.java

private static Object getCacheKey(Class<?> cl, String methodName) {
    return new MultiKey(cl, methodName);
}