1 /*******************************************************************************
2 * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
9 * VTT Technical Research Centre of Finland - initial API and implementation
10 *******************************************************************************/
11 package org.simantics.databoard.binding.factory;
13 import org.simantics.databoard.binding.Binding;
14 import org.simantics.databoard.binding.error.BindingConstructionException;
15 import org.simantics.databoard.binding.error.RuntimeBindingConstructionException;
16 import org.simantics.databoard.type.Datatype;
18 public class SingleBindingScheme implements BindingScheme {
22 public SingleBindingScheme(Binding b) {
27 public Binding getBinding(Datatype type)
28 throws BindingConstructionException {
29 if (type.equals(b.type())) return b;
30 throw new BindingConstructionException(type+" is not supported");
34 public Binding getBindingUnchecked(Datatype type)
35 throws RuntimeBindingConstructionException {
36 if (type.equals(b.type())) return b;
37 throw new RuntimeBindingConstructionException(new BindingConstructionException(type+" is not supported"));
41 public boolean supportsType(Datatype type) {
42 return type.equals( b.type() );