| /******************************************************************************* |
| * Copyright (c) 2018 Robert Bosch GmbH. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * Robert Bosch GmbH - initial API and implementation |
| *******************************************************************************/ |
| |
| package org.eclipse.app4mc.transformation.extensions |
| |
| import java.util.HashMap |
| |
| class CustomObjectsStore { |
| |
| private var cls_instance_map = new HashMap(); |
| |
| private var data_map = new HashMap<String, Object>(); |
| |
| |
| public def <T> T getInstance(Object cls) { |
| |
| val value = cls_instance_map.get(cls); |
| |
| return value as T |
| } |
| |
| public def <T> void injectMembers(Object cls, T instance) { |
| cls_instance_map.put(cls, instance); |
| |
| } |
| |
| public def <T> void indexData(String key, T value){ |
| |
| data_map.put(key, value); |
| } |
| |
| public def <T> getData(String key){ |
| data_map.get(key) as T |
| } |
| |
| public def void clearCache() { |
| cls_instance_map.clear |
| } |
| } |