2 In Databoard all values have a type representation, [../javadoc/org/simantics/databoard/type/Datatype.html|Datatype].
3 It is the base abstract class for all concrete type classes (See table below).
4 There is a facade class utility ([../javadoc/org/simantics/databoard/Datatypes.html|Datatypes]) that provides functions to most of the Datatype library's features.
6 '''[../javadoc/org/simantics/databoard/type|org.simantics.databoard.type]'''.
7 {| style="background-color: #f9f9f9; border: 1px solid #aaaaaa; "
8 |- style="background-color: #e9e9e9; " |
9 | '''Class''' || '''Description'''
11 | [../javadoc/org/simantics/databoard/type/Datatype.html|Datatype] || Base class for all data types
13 | [../javadoc/org/simantics/databoard/type/RecordType.html|RecordType] || Record
15 | [../javadoc/org/simantics/databoard/type/ArrayType.html|ArrayType] || Array - an ordered sequence of elements of one type.
17 | [../javadoc/org/simantics/databoard/type/MapType.html|MapType] || Map - an ordered map of keys to values.
19 | [../javadoc/org/simantics/databoard/type/UnionType.html|UnionType] || Union
21 | [../javadoc/org/simantics/databoard/type/BooleanType.html|BooleanType],[../javadoc/org/simantics/databoard/type/IntType.html|IntType],[../javadoc/org/simantics/databoard/type/LongType.html|LongType],[../javadoc/org/simantics/databoard/type/FloatType.html|FloatType],[../javadoc/org/simantics/databoard/type/DoubleType.html|DoubleType]
22 | Primitive and numeric types
24 | [../javadoc/org/simantics/databoard/type/StringType.html|StringType] || String
26 | [../javadoc/org/simantics/databoard/type/OptionalType.html|OptionalType] || Optional value
28 | [../javadoc/org/simantics/databoard/type/VariantType.html|VariantType] || Variant value
32 Datatype can be acquired or created using one of the following methods:
35 * [[binding#Reflection|Reflection]]-Read from a Class
36 * Read from string of [[Databoard_Specification|the text notation]].
38 Datatype type = new DoubleType();
39 Datatype type = Datatypes.DOUBLE;
40 Datatype type = Datatypes.getDatatype( Double.class );
42 Datatypes.addDefinition("type Node = { id : String; children : Node[] }");
43 Datatype type = Datatypes.getDatatype("Node");
47 Datatypes are parsed using <code>Datatypes.DatatypeRepository</code>.
49 Datatypes.addDefinition("type Node = { id : String; children : Node[] }");
50 Datatype type = Datatypes.getDatatype("Node");
53 Types are printed to types and definitions with
55 String type = type.toString();
57 DatatypeRepository repo = new DatatypeRepository();
58 repo.add("temp1", type);
59 String typeDef = repo.toString();
63 A node is a recursive type. With databoard typesystem it could be stated as
67 displayNames : LocalizedTexts;
69 value : Optional(Variant);
73 [[Image:NodeType.png|Type presented as tree]]
76 A couple of instances with Databoard value notation:
80 displayNames = map{
\93en
\94 =
\93Instrument
\93 }
84 displayNames = map{
\93en
\94 =
\93Child
\94} },
88 value =
\93<root>
\94 : String
92 [[Image:NodeInstance.png|Node values preseted as tree]]