org.simantics.databoard.type
Class RecordType

java.lang.Object
  extended by org.simantics.databoard.type.Datatype
      extended by org.simantics.databoard.type.RecordType

public class RecordType
extends Datatype


Nested Class Summary
 
Nested classes/interfaces inherited from class org.simantics.databoard.type.Datatype
Datatype.Visitor<T>, Datatype.Visitor1
 
Field Summary
 MethodTypeDefinition[] methods
           
 boolean referable
           
static Datatype VOID_TYPE
           
 
Constructor Summary
RecordType()
           
RecordType(boolean referable, Component... components)
           
 
Method Summary
<T> T
accept(Datatype.Visitor<T> v)
           
 void accept(Datatype.Visitor1 v, java.lang.Object obj)
           
 void addComponent(java.lang.String name, Datatype type)
           
 int count()
          Get component type count
 Component getComponent(int index)
          Get component by index.
 Component getComponent(java.lang.String fieldName)
          Get component by name.
 java.lang.Integer getComponentIndex(java.lang.String fieldName)
          Get component by name.
 int getComponentIndex2(java.lang.String fieldName)
          Get component by name.
 Component[] getComponents()
           
 Datatype getComponentType(ChildReference path)
          Get component type
 Datatype getComponentType(int index)
          Get component type by index
 Datatype getComponentType(java.lang.String fieldName)
          Get component Datatype by field name
 int hashCode()
           
 boolean isReferable()
           
 boolean isTupleType()
          Return true if the record is a tuple.
 void removeComponent(java.lang.String name)
           
 void setComponents(Component[] components)
           
 
Methods inherited from class org.simantics.databoard.type.Datatype
equals, toSingleLineString, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

VOID_TYPE

public static final Datatype VOID_TYPE

referable

public boolean referable

methods

public MethodTypeDefinition[] methods
Constructor Detail

RecordType

public RecordType()

RecordType

public RecordType(boolean referable,
                  Component... components)
Method Detail

isReferable

public boolean isReferable()

setComponents

public void setComponents(Component[] components)

addComponent

public void addComponent(java.lang.String name,
                         Datatype type)

removeComponent

public void removeComponent(java.lang.String name)

count

public int count()
Description copied from class: Datatype
Get component type count

Specified by:
count in class Datatype
Returns:
component count

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

accept

public void accept(Datatype.Visitor1 v,
                   java.lang.Object obj)
Specified by:
accept in class Datatype

accept

public <T> T accept(Datatype.Visitor<T> v)
Specified by:
accept in class Datatype

isTupleType

public boolean isTupleType()
Return true if the record is a tuple. Tuple is a record with all components are named as a number, the index number of the field. Empty record is a tuple

Returns:
true if the record type is a tuple.

getComponentType

public Datatype getComponentType(int index)
Get component type by index

Specified by:
getComponentType in class Datatype
Parameters:
index - index
Returns:
componenet type or null if index was invalid

getComponentType

public Datatype getComponentType(ChildReference path)
                          throws java.lang.IllegalArgumentException
Description copied from class: Datatype
Get component type

Specified by:
getComponentType in class Datatype
Parameters:
path - child path or null to return this.
Returns:
datatype
Throws:
java.lang.IllegalArgumentException

getComponentIndex

public java.lang.Integer getComponentIndex(java.lang.String fieldName)
Get component by name.

Parameters:
fieldName - component name
Returns:
component index or null if one does not exist

getComponentIndex2

public int getComponentIndex2(java.lang.String fieldName)
Get component by name.

Parameters:
fieldName - component name
Returns:
component index or -1 if one does not exist

getComponentType

public Datatype getComponentType(java.lang.String fieldName)
Get component Datatype by field name

Parameters:
fieldName -
Returns:
datatype or null

getComponent

public Component getComponent(java.lang.String fieldName)
Get component by name.

Parameters:
fieldName - component name
Returns:
component or null if one does not exist

getComponent

public Component getComponent(int index)
Get component by index.

Parameters:
index - component index
Returns:
component or null if one does not exist

getComponents

public Component[] getComponents()