Skip to main content
summaryrefslogtreecommitdiffstats
blob: df8d1495ca2643ab4ff4ce5c472c3b05ffd97dee (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package org.eclipse.xtend.backend.common;

import java.util.HashMap;
import java.util.Map;


/**
 * This class serves as "black box" storage for runtime state contributors may wish to store. It is
 *  accessed by a "unique key" which must be chosen by the contributor to be guaranteed unique. The
 *  recommended best practice is to use a Class object specific to the contributor.<br>
 *  
 * This state is re-initialized for every new ExecutionContext.
 * 
 * @author Arno Haase (http://www.haase-consulting.com)
 */
public class ContributionStateContext {
    private Map<Object, Object> _state = new HashMap<Object, Object>();
    
    public Object retrieveState (Object uniqueKey) {
        return _state.get (uniqueKey);
    }
     
    public void storeState (Object uniqueKey, Object state) {
        _state.put (uniqueKey, state);
    }
}

Back to the top