blob: 236c3ced2df5487269d9bdb2f5a470b355376ec4 [file] [log] [blame]
/**
********************************************************************************
* Copyright (c) 2018-2020 Robert Bosch GmbH.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Robert Bosch GmbH - initial API and implementation
********************************************************************************
*/
package org.eclipse.app4mc.transformation.extensions
import java.util.HashMap
import org.osgi.service.component.annotations.Component
import org.osgi.service.component.annotations.ServiceScope
@Component(scope =ServiceScope.SINGLETON)
class CustomObjectsStore implements ICustomObjectsStore{
var clsInstanceMap = new HashMap();
var dataMap = new HashMap<String, Object>();
override <T> T getInstance(Object cls) {
val value = clsInstanceMap.get(cls);
return value as T
}
override <T> void injectMembers(Object cls, T instance) {
clsInstanceMap.put(cls, instance);
}
override <T> void indexData(String key, T value){
dataMap.put(key, value);
}
override <T> getData(String key){
dataMap.get(key) as T
}
override void clearCache() {
clsInstanceMap.clear
dataMap.clear
}
}