-/*******************************************************************************\r
- * Copyright (c) 2010 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- * VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
+/*******************************************************************************
+ * 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.mutable;
-import java.util.Set;\r
-\r
-import org.simantics.databoard.adapter.AdapterFactory;\r
-import org.simantics.databoard.binding.Binding;\r
-import org.simantics.databoard.binding.error.BindingException;\r
-import org.simantics.databoard.binding.reflection.ClassBindingFactory;\r
+import java.util.Set;
+
+import org.simantics.databoard.adapter.AdapterFactory;
+import org.simantics.databoard.binding.Binding;
+import org.simantics.databoard.binding.error.BindingException;
+import org.simantics.databoard.binding.reflection.ClassBindingFactory;
/**
* MutableVariantBinding binds VariantType to {@link MutableVariant} Class.
*/
public class MutableVariantBinding extends ImmutableVariantBinding {
- \r
- public MutableVariantBinding(ClassBindingFactory bindingFactory, AdapterFactory adapterFactory) {\r
- super(bindingFactory, adapterFactory);\r
- }\r
- \r
- @Override\r
- public Object create(Binding binding, Object value) throws BindingException {\r
- return new MutableVariant(binding, value);\r
- }\r
- \r
+
+ public MutableVariantBinding(ClassBindingFactory bindingFactory, AdapterFactory adapterFactory) {
+ super(bindingFactory, adapterFactory);
+ }
+
+ @Override
+ public Object create(Binding binding, Object value) throws BindingException {
+ return new MutableVariant(binding, value);
+ }
+
@Override
public boolean isImmutable() {
return false;
}
-\r
- @Override\r
- public boolean isInstance(Object obj) {\r
- if (obj==null) return false;\r
- if (obj instanceof MutableVariant == false) return false;\r
- return true;\r
- }\r
- \r
- @Override\r
- public void assertInstaceIsValid(Object obj, Set<Object> validInstances) throws BindingException {\r
- if (obj==null) throw new BindingException("null value is not MutableVariant");\r
- if (obj instanceof MutableVariant == false) throw new BindingException("wrong class, MutableVariant expected");\r
- MutableVariant var = (MutableVariant) obj;\r
- if (var.binding==null) throw new BindingException("Binding is expected"); \r
- var.binding.assertInstaceIsValid(var.value, validInstances);\r
- }\r
+
+ @Override
+ public boolean isInstance(Object obj) {
+ if (obj==null) return false;
+ if (obj instanceof MutableVariant == false) return false;
+ return true;
+ }
+
+ @Override
+ public void assertInstaceIsValid(Object obj, Set<Object> validInstances) throws BindingException {
+ if (obj==null) throw new BindingException("null value is not MutableVariant");
+ if (obj instanceof MutableVariant == false) throw new BindingException("wrong class, MutableVariant expected");
+ MutableVariant var = (MutableVariant) obj;
+ if (var.binding==null) throw new BindingException("Binding is expected");
+ var.binding.assertInstaceIsValid(var.value, validInstances);
+ }
@Override
public void setContent(Object variant, Binding binding, Object value)