]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.databoard/src/org/simantics/databoard/accessor/VariantAccessor.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.databoard / src / org / simantics / databoard / accessor / VariantAccessor.java
diff --git a/bundles/org.simantics.databoard/src/org/simantics/databoard/accessor/VariantAccessor.java b/bundles/org.simantics.databoard/src/org/simantics/databoard/accessor/VariantAccessor.java
new file mode 100644 (file)
index 0000000..7d15e8f
--- /dev/null
@@ -0,0 +1,69 @@
+/*******************************************************************************\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.accessor;
+
+import org.simantics.databoard.accessor.error.AccessorConstructionException;\r
+import org.simantics.databoard.accessor.error.AccessorException;\r
+import org.simantics.databoard.binding.Binding;\r
+import org.simantics.databoard.type.Datatype;\r
+import org.simantics.databoard.type.VariantType;\r
+
+
+public interface VariantAccessor extends Accessor {
+
+       /**
+        * Get an accessor to the variant's content. 
+        * 
+        * @return value
+        * @throws AccessorException
+        */
+       <T extends Accessor> T getContentAccessor() throws AccessorConstructionException;
+       
+       /**
+        * Set the content of this variant.
+        * 
+        * (Note! this methods sets the _content_ value, in contrast to 
+        * {@link Accessor#setValue(org.simantics.databoard.binding.Binding, Object)} 
+        * which sets the _variant_ value.  
+        * 
+        * @param valueBinding
+        * @param value
+        * @throws AccessorException
+        */
+       void setContentValue(Binding valueBinding, Object value) throws AccessorException;
+       \r
+       /**\r
+        * Get the content of this variant\r
+        *  \r
+        * @param contentBinding\r
+        * @return content\r
+        * @throws AccessorException\r
+        */
+       Object getContentValue(Binding contentBinding) throws AccessorException;\r
+       \r
+       /**\r
+        * Get the type of the content\r
+        * \r
+        * @return type\r
+        * @throws AccessorException\r
+        */
+       Datatype getContentType() throws AccessorException;
+       \r
+       /**\r
+        * Get the type of this variant.\r
+        * \r
+        * @return VariantType always\r
+        */
+       VariantType type();
+       
+}
+