]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.databoard/src/org/simantics/databoard/accessor/VariantAccessor.java
Improve Databoard's dynamically typed data capabilities.
[simantics/platform.git] / bundles / org.simantics.databoard / src / org / simantics / databoard / accessor / VariantAccessor.java
1 /*******************************************************************************\r
2  *  Copyright (c) 2010 Association for Decentralized Information Management in\r
3  *  Industry THTH ry.\r
4  *  All rights reserved. This program and the accompanying materials\r
5  *  are made available under the terms of the Eclipse Public License v1.0\r
6  *  which accompanies this distribution, and is available at\r
7  *  http://www.eclipse.org/legal/epl-v10.html\r
8  *\r
9  *  Contributors:\r
10  *      VTT Technical Research Centre of Finland - initial API and implementation\r
11  *******************************************************************************/\r
12 package org.simantics.databoard.accessor;
13
14 import org.simantics.databoard.accessor.error.AccessorConstructionException;\r
15 import org.simantics.databoard.accessor.error.AccessorException;\r
16 import org.simantics.databoard.binding.Binding;\r
17 import org.simantics.databoard.type.Datatype;\r
18 import org.simantics.databoard.type.VariantType;\r
19
20
21 public interface VariantAccessor extends Accessor {
22
23         /**
24          * Get an accessor to the variant's content. 
25          * 
26          * @return value
27          * @throws AccessorException
28          */
29         <T extends Accessor> T getContentAccessor() throws AccessorConstructionException;
30         
31         /**
32          * Set the content of this variant.
33          * 
34          * (Note! this methods sets the _content_ value, in contrast to 
35          * {@link Accessor#setValue(org.simantics.databoard.binding.Binding, Object)} 
36          * which sets the _variant_ value.  
37          * 
38          * @param valueBinding
39          * @param value
40          * @throws AccessorException
41          */
42         void setContentValue(Binding valueBinding, Object value) throws AccessorException;
43         \r
44         /**\r
45          * Get the content of this variant\r
46          *  \r
47          * @param contentBinding\r
48          * @return content\r
49          * @throws AccessorException\r
50          */
51         Object getContentValue(Binding contentBinding) throws AccessorException;\r
52         \r
53         /**\r
54          * Get the type of the content\r
55          * \r
56          * @return type\r
57          * @throws AccessorException\r
58          */
59         Datatype getContentType() throws AccessorException;
60         \r
61         /**\r
62          * Get the type of this variant.\r
63          * \r
64          * @return VariantType always\r
65          */
66         VariantType type();
67         
68 }
69