1 /*******************************************************************************
2 * Copyright (c) 2007, 2011 Association for Decentralized Information Management in
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.databoard.binding.factory;
14 import java.util.HashMap;
17 import org.simantics.databoard.binding.reflection.BindingRequest;
18 import org.simantics.databoard.type.Datatype;
20 public class TypeRepository {
22 Map<Datatype, BindingRequest> typeMap = new HashMap<Datatype, BindingRequest>();
23 Map<String, BindingRequest> classMap = new HashMap<String, BindingRequest>();
25 public synchronized void put(Datatype type, BindingRequest br) {
26 typeMap.put(type, br);
27 classMap.put(br.className.replace('$', '.'), br);
30 public synchronized boolean containsType( Datatype type ) {
31 return typeMap.containsKey( type );
34 public synchronized BindingRequest getRequestForType(Datatype type) {
35 return typeMap.get(type);
38 public synchronized BindingRequest getRequest(String className) {
39 if (className.indexOf('$')>=0) className = className.replace('$', '.');
40 return classMap.get(className);