ThingWorx Edge Java SDK > Application Details > Infotables > Data Shapes
  
Data Shapes
Data shapes are required for INFOTABLE base types and for event data. You can define data shapes using two classes of the ThingWorx Edge Java SDK, namely DataShapeDefinition and FieldDefinition. The next two sections explain how to use these classes.
DataShapeDefinition Class
Use the DataShapeDefinition class to model the metadata of ThingWorx data shapes. Define data shapes in the instance of the VirtualThing class. These definitions are required for INFOTABLE base types and for event data. The only mechanism for defining a data shape is in code.
FieldDefinition Class
A definition for a data shape consists of collections of field definitions. Field definitions represent a parameter or setting in a data shape.
name — The name of the field.
description — A description of the field.
baseType — The base type that the field represents.
For example:
// Create a collection to hold the field definitions
FieldDefinitionCollection fields = new FieldDefinitionCollection();

// Define the fields
fields.addFieldDefinition(new FieldDefinition("Field1",
BaseTypes.STRING));
fields.addFieldDefinition(new FieldDefinition("Field2",
BaseTypes.NUMBER));
fields.addFieldDefinition(new FieldDefinition("Field3",
BaseTypes.INTEGER));

// Add the DataShapeDefinition to the VirtualThing
this.defineDataShapeDefinition("MyDataShape", fields);