1 /*******************************************************************************
2 * Copyright (c) 2010 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.mutable;
14 import org.simantics.databoard.binding.StringBinding;
15 import org.simantics.databoard.binding.error.BindingException;
16 import org.simantics.databoard.primitives.MutableString;
17 import org.simantics.databoard.type.StringType;
20 * Binds StringType to {@link MutableString}
22 * @author Toni Kalajainen <toni.kalajainen@vtt.fi>
24 public class MutableStringBinding extends StringBinding {
26 public MutableStringBinding(StringType type) {
31 public Object create(String value) {
32 MutableString result = new MutableString();
38 public String getValue(Object o) throws BindingException {
39 MutableString result = (MutableString)o;
40 return (String) result.value;
44 public boolean isInstance(Object obj) {
45 return (obj instanceof MutableString) && ( ((MutableString)obj).value instanceof String );
49 public void setValue(Object o, String newValue) throws BindingException {
50 MutableString result = (MutableString)o;
51 result.value = newValue;