=Datatype= In Databoard all values have a type representation, [../javadoc/org/simantics/databoard/type/Datatype.html|Datatype]. It is the base abstract class for all concrete type classes (See table below). There is a facade class utility ([../javadoc/org/simantics/databoard/Datatypes.html|Datatypes]) that provides functions to most of the Datatype library's features. '''[../javadoc/org/simantics/databoard/type|org.simantics.databoard.type]'''. {| style="background-color: #f9f9f9; border: 1px solid #aaaaaa; " |- style="background-color: #e9e9e9; " | | '''Class''' || '''Description''' |- | [../javadoc/org/simantics/databoard/type/Datatype.html|Datatype] || Base class for all data types |- | [../javadoc/org/simantics/databoard/type/RecordType.html|RecordType] || Record |- | [../javadoc/org/simantics/databoard/type/ArrayType.html|ArrayType] || Array - an ordered sequence of elements of one type. |- | [../javadoc/org/simantics/databoard/type/MapType.html|MapType] || Map - an ordered map of keys to values. |- | [../javadoc/org/simantics/databoard/type/UnionType.html|UnionType] || Union |- | [../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] | Primitive and numeric types |- | [../javadoc/org/simantics/databoard/type/StringType.html|StringType] || String |- | [../javadoc/org/simantics/databoard/type/OptionalType.html|OptionalType] || Optional value |- | [../javadoc/org/simantics/databoard/type/VariantType.html|VariantType] || Variant value |} Datatype can be acquired or created using one of the following methods: * Construct new * Constant * [[binding#Reflection|Reflection]]-Read from a Class * Read from string of [[Databoard_Specification|the text notation]].
    Datatype type = new DoubleType();
    Datatype type = Datatypes.DOUBLE;
    Datatype type = Datatypes.getDatatype( Double.class );
    
    Datatypes.addDefinition("type Node = { id : String; children : Node[] }");
    Datatype type = Datatypes.getDatatype("Node");
==Parsing== Datatypes are parsed using Datatypes.DatatypeRepository.
    Datatypes.addDefinition("type Node = { id : String; children : Node[] }");
    Datatype type = Datatypes.getDatatype("Node");
Types are printed to types and definitions with
    String type = type.toString();
    
    DatatypeRepository repo = new DatatypeRepository();
    repo.add("temp1", type);
    String typeDef = repo.toString();
==Structure Example== A node is a recursive type. With databoard typesystem it could be stated as
  type Node = {
         id : String;
         displayNames : LocalizedTexts;
         children : Node[];
         value : Optional(Variant);
       }
[[Image:NodeType.png|Type presented as tree]] A couple of instances with Databoard value notation:
  root : Node = {
           id = “PI_01”
           displayNames = map{ “en” = “Instrument “ }
           children = 
            [ 
              {id=”Child”, 
               displayNames = map{ “en” = “Child”} },
               value = 5 : Integer
              }
            ]
           value = “” : String
         }
[[Image:NodeInstance.png|Node values preseted as tree]]