X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.databoard%2Fsrc%2Forg%2Fsimantics%2Fdataboard%2Fbinding%2FStringBinding.java;h=b3b970cfb1e5bc1a7ae368ac55f04e7b3647a05e;hb=HEAD;hp=a15722aab7805c6232124e69f9e57de71f18e1bb;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.databoard/src/org/simantics/databoard/binding/StringBinding.java b/bundles/org.simantics.databoard/src/org/simantics/databoard/binding/StringBinding.java index a15722aab..b3b970cfb 100644 --- a/bundles/org.simantics.databoard/src/org/simantics/databoard/binding/StringBinding.java +++ b/bundles/org.simantics.databoard/src/org/simantics/databoard/binding/StringBinding.java @@ -1,27 +1,27 @@ -/******************************************************************************* - * Copyright (c) 2010 Association for Decentralized Information Management in - * Industry THTH ry. - * 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: - * VTT Technical Research Centre of Finland - initial API and implementation - *******************************************************************************/ +/******************************************************************************* + * Copyright (c) 2010 Association for Decentralized Information Management in + * Industry THTH ry. + * 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: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ package org.simantics.databoard.binding; -import java.util.IdentityHashMap; -import java.util.Set; -import java.util.regex.Pattern; - -import org.simantics.databoard.accessor.reference.ChildReference; -import org.simantics.databoard.binding.error.BindingException; -import org.simantics.databoard.binding.error.RuntimeBindingException; -import org.simantics.databoard.binding.impl.BindingPrintContext; -import org.simantics.databoard.type.StringType; -import org.simantics.databoard.util.IdentityPair; -import org.simantics.databoard.util.Range; +import java.util.IdentityHashMap; +import java.util.Set; +import java.util.regex.Pattern; + +import org.simantics.databoard.accessor.reference.ChildReference; +import org.simantics.databoard.binding.error.BindingException; +import org.simantics.databoard.binding.error.RuntimeBindingException; +import org.simantics.databoard.binding.impl.BindingPrintContext; +import org.simantics.databoard.type.StringType; +import org.simantics.databoard.util.IdentityPair; +import org.simantics.databoard.util.Range; /** * This is a binding of String Type and a Java Object. @@ -30,7 +30,7 @@ import org.simantics.databoard.util.Range; * @author Toni Kalajainen */ public abstract class StringBinding extends Binding { - + public StringBinding(StringType type) { this.type = type; } @@ -47,13 +47,13 @@ public abstract class StringBinding extends Binding { } catch (BindingException e) { throw new RuntimeBindingException(e); } - } - - @Override - public void readFrom(Binding srcBinding, Object src, Object dst) - throws BindingException { - String v = ((StringBinding)srcBinding).getValue(src); - setValue(dst, v); + } + + @Override + public void readFrom(Binding srcBinding, Object src, Object dst) + throws BindingException { + String v = ((StringBinding)srcBinding).getValue(src); + setValue(dst, v); } public abstract String getValue(Object o) throws BindingException; @@ -125,29 +125,29 @@ public abstract class StringBinding extends Binding { @Override public int deepHashValue(Object value, IdentityHashMap hashedObjects) throws BindingException { return getValue(value).hashCode(); - } - - @Override - protected void toString(Object value, BindingPrintContext ctx) throws BindingException { - ctx.b.append('"'); - ctx.b.append(getValue(value)); - ctx.b.append('"'); - } - - @Override - public Binding getComponentBinding(ChildReference path) { - if (path==null) return this; - throw new IllegalArgumentException(); - } - - @Override - public int getComponentCount() { - return 0; - } - - @Override - public Binding getComponentBinding(int index) { - throw new IllegalArgumentException(); + } + + @Override + protected void toString(Object value, BindingPrintContext ctx) throws BindingException { + ctx.b.append('"'); + ctx.b.append(getValue(value)); + ctx.b.append('"'); + } + + @Override + public Binding getComponentBinding(ChildReference path) { + if (path==null) return this; + throw new IllegalArgumentException(); + } + + @Override + public int getComponentCount() { + return 0; + } + + @Override + public Binding getComponentBinding(int index) { + throw new IllegalArgumentException(); } }