-/*******************************************************************************\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
-package org.simantics.databoard.binding.reflection;\r
-\r
-import org.simantics.databoard.binding.Binding;\r
-import org.simantics.databoard.binding.RecordBinding;\r
-import org.simantics.databoard.binding.error.BindingException;\r
-import org.simantics.databoard.type.Datatype;\r
-\r
-public class ConstantBinding extends RecordBinding {\r
-\r
- Object value;\r
- \r
- public ConstantBinding(Datatype type, Object constantValue) {\r
- this.type = type;\r
- this.componentBindings = new Binding[0];\r
- this.value = constantValue;\r
- }\r
-\r
- @Override\r
- public Object create(Object... value) throws BindingException {\r
- return this.value;\r
- }\r
-\r
- @Override\r
- public Object getComponent(Object obj, int index) throws BindingException {\r
- throw new BindingException();\r
- }\r
-\r
- @Override\r
- public Object createPartial() throws BindingException {\r
- return value;\r
- }\r
-\r
- @Override\r
- public void setComponents(Object obj, Object... value) throws BindingException {\r
-// throw new BindingException();\r
- }\r
- \r
- @Override\r
- public void setComponent(Object obj, int index, Object value)\r
- throws BindingException {\r
-// throw new BindingException();\r
- }\r
-\r
- @Override\r
- public boolean isInstance(Object obj) {\r
- return obj==value;\r
- }\r
- \r
- @Override\r
- public boolean isImmutable() {\r
- return true;\r
- }\r
- \r
- @Override\r
- protected boolean baseEquals( Object obj ) {\r
- return super.baseEquals( obj ) && value == ((ConstantBinding)obj).value;\r
- }\r
- \r
- @Override\r
- public int baseHashCode() {\r
- return super.baseHashCode() + 7 * value.hashCode(); \r
- } \r
-}\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.reflection;
+
+import org.simantics.databoard.binding.Binding;
+import org.simantics.databoard.binding.RecordBinding;
+import org.simantics.databoard.binding.error.BindingException;
+import org.simantics.databoard.type.Datatype;
+
+public class ConstantBinding extends RecordBinding {
+
+ Object value;
+
+ public ConstantBinding(Datatype type, Object constantValue) {
+ this.type = type;
+ this.componentBindings = new Binding[0];
+ this.value = constantValue;
+ }
+
+ @Override
+ public Object create(Object... value) throws BindingException {
+ return this.value;
+ }
+
+ @Override
+ public Object getComponent(Object obj, int index) throws BindingException {
+ throw new BindingException();
+ }
+
+ @Override
+ public Object createPartial() throws BindingException {
+ return value;
+ }
+
+ @Override
+ public void setComponents(Object obj, Object... value) throws BindingException {
+// throw new BindingException();
+ }
+
+ @Override
+ public void setComponent(Object obj, int index, Object value)
+ throws BindingException {
+// throw new BindingException();
+ }
+
+ @Override
+ public boolean isInstance(Object obj) {
+ return obj==value;
+ }
+
+ @Override
+ public boolean isImmutable() {
+ return true;
+ }
+
+ @Override
+ protected boolean baseEquals( Object obj ) {
+ return super.baseEquals( obj ) && value == ((ConstantBinding)obj).value;
+ }
+
+ @Override
+ public int baseHashCode() {
+ return super.baseHashCode() + 7 * value.hashCode();
+ }
+}
+