Key terms reference: FlexVertex Glossary
Learn how to define object-oriented classes, properties, inheritance, and connections in FlexVertex using Voyager syntax.
FlexVertex classes are defined using the IFlexClass interface. Each class contains properties and optional display formatting settings.
⚠️ Best Practice: Clean up before you create.
Before creating a class, check if it already exists using schema.classExists("ClassName"), and delete it with schema.deleteClass("ClassName").
If you don’t do this, re-running your setup script will either fail or silently skip steps—leading to confusing or inconsistent results.
For brevity, this pattern appears only once—but it should be used consistently whenever defining classes during development.
Syntax:
// REQUIRED in dev/test: prevents duplicate definitions or schema errors. For brevity, only shown here.
if (schema.classExists("Individual")) schema.deleteClass("Individual");
IFlexClass individual = schema.createClass("Individual");
individual.createProperty("Name", FlexType.String)
.isMandatory(true)
.isNotNull(true);
individual.createProperty("DOB", FlexType.DateTime)
.setAttribute("DateTimeFormat","yyyy-MM-dd");
individual.createProperty("InfluencerRating", FlexType.Integer);
individual.setLabelFormat("%s", "Name");
individual.setImagePropertyName("ImageKey");
individual.setDefaultImage(personImage);
individual.save();
schema.save(); // 🔴 REQUIRED to commit changes to the schema
You may elect to define a class as abstract, meaning it can not be instantiated directly but only serve as a base class for other classes to inherit from.
Syntax:
IFlexClass payment = schema.createClass("Payment");
payment.isAbstract(true);
payment.createProperty("Type", FlexType.String)
.isMandatory(true)
.isNotNull(true);
payment.save();
FlexVertex supports various inheritance approaches:
Syntax:
IFlexClass vehicle = schema.createClass("Vehicle")
.isAbstract(true);
vehicle.save();
IFlexClass car = schema.createClass("Car", vehicle);
car.save();
Syntax:
IFlexClass vehicle = schema.createClass("Vehicle")
.isAbstract(true);
vehicle.save();
IFlexClass car = schema.createClass("Car", vehicle);
car.save();
IFlexClass truck = schema.createClass("Truck", vehicle);
truck.save();
Syntax:
IFlexClass payment = schema.createClass("Payment")
.isAbstract(true);
payment.save();
IFlexClass creditCard = schema.createClass("CreditCardPayment", payment);
creditCard.save();
Syntax:
IFlexClass digital = schema.createClass("DigitalAsset")
.isAbstract(true);
digital.save();
IFlexClass transferable = schema.createClass("Transferable")
.isAbstract(true);
transferable.save();
IFlexClass nft = schema.createClass("NFT", digital, transferable);
nft.save();
During development, it’s important to remove existing classes before redefining them. This prevents errors, overrides, or silent failures when re-running scripts.
Use this pattern before creating any class:
if (schema.classExists("MyClass")) schema.deleteClass("MyClass");
FlexVertex supports a rich set of property types, designed to mirror real-world object modeling needs. Properties are defined using:
class.createProperty("PropertyName", FlexType.TypeName);
| Type | Description |
|---|---|
String |
Text values |
Integer |
32-bit integer |
Long |
64-bit integer |
Float |
32-bit floating point |
Double |
64-bit floating point |
Boolean |
True/false |
DateTime |
Date and time with formatting support |
Byte |
8-bit integer |
Short |
16-bit integer |
UUID |
Universally unique identifier |
ByteArray |
Binary data (e.g., images) |
Currency |
Currency values (e.g., ISO 4217 codes) |
Key |
System-generated primary key |
| Type | Description |
|---|---|
Link |
Connection to another object |
Object |
Reference to any FlexObject or subclass |
Component |
Embedded value object (owned by parent) |
Property |
Metadata describing a property itself |
Serializable |
Any object implementing IFlexSerializable |
Set<T> |
Unordered collection of unique elements |
List<T> |
Ordered collection (may contain duplicates) |
Map<K,V> |
Key/value pairs |
These types are planned but not currently supported:
BigDecimalBigIntegerIFlexClass book = schema.createClass("Book");
book.createProperty("Title", FlexType.String)
.isMandatory(true)
.isNotNull(true);
book.createProperty("Pages", FlexType.Integer)
.setDefault(1);
book.createProperty("PublishedDate", FlexType.DateTime)
.setAttribute("DateTimeFormat", "yyyy-MM-dd");
book.createProperty("Genres", FlexType.Set); // e.g., Fiction, Mystery, etc.
book.save();
Creating data in FlexVertex—such as objects and connections—requires two levels of saving:
.save().schema.save() to finalize and persist those changes.⚠️ Required: schema.save() commits your data.
After you create or modify any data—like FlexObject or FlexConnection instances—you must call schema.save() to commit those changes to the system.
Without this step, your objects and connections will appear to save correctly in memory, but they will not persist across sessions or be visible in Commander.
Even if you’ve already used schema.save() after creating classes, you still need to call it again after your DML operations (data creation or updates).
| Action | Required Save Step |
|---|---|
| Creating/modifying a class | .save() on class → schema.save() |
| Creating/modifying a property | .save() on class → schema.save() |
| Creating a data object | .save() on object → schema.save() |
| Creating a connection | .save() on connection → schema.save() |
IFlexObject john = new FlexObject(schema, "Patient");
john.setProperty("Name", "John Doe");
john.setProperty("DOB", new FlexDateTime("yyyy-MM-dd", "1980-05-12"));
john.setProperty("MedicalRecordNumber", "MRN123456");
john.save();
IFlexObject drSmith = new FlexObject(schema, "Doctor");
drSmith.setProperty("Name", "Dr. Sarah Smith");
drSmith.setProperty("DOB", new FlexDateTime("yyyy-MM-dd", "1975-03-22"));
drSmith.setProperty("Specialty", "Cardiology");
drSmith.save();
IFlexConnection visit1 = new FlexConnection(schema, "Visit", john, drSmith);
visit1.setProperty("VisitDate", new FlexDateTime("yyyy-MM-dd", "2024-12-01"));
visit1.setProperty("Reason", "Annual Check-up");
visit1.save();
schema.save(); // 🔴 REQUIRED: without this, nothing above will persist
Ask the FlexVertex First Mate:
“Can you show me how to define a
Bookclass with authors and reviews?”
Or:
“Validate this
.voyagesubclass declaration for me.”
Explore: