Class DataObject
- All Implemented Interfaces:
AutoCloseable
DataObject is a self-contained value that holds the properties described by a DataType, addressed through DataPropertyPath.
DataObjects are immutable and thread-safe for reading. Use DataObject.Builder to create or modify one.
- Since:
- 2026.1
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classAllows the incremental creation of aDataObject. -
Method Summary
Modifier and TypeMethodDescriptionReturns thisDataObjectas aBuilder, making it possible to copy and modify its values.voidclose()booleanprotected voidfinalize()Returns the data type describing thisDataObject's properties.getListSize(DataPropertyPath propertyPath) Returns the element count of a list-typed property.getListSize(String propertyName) Convenience overload of getListSize that resolves the property by name on this data object's data type.<T> TgetValue(DataPropertyPath propertyPath) Accesses the value for the given property.<T> TConvenience overload of getValue that resolves the property by name on this data object's data type.inthashCode()static DataObject.BuilderReturns a newDataObjectBuilder.
-
Method Details
-
finalize
protected void finalize() -
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
newBuilder
Returns a newDataObjectBuilder.- Returns:
- a new
DataObjectBuilder.
-
asBuilder
Returns thisDataObjectas aBuilder, making it possible to copy and modify its values.The data type cannot be changed through the returned builder.
- Returns:
- this
DataObjectas aBuilder.
-
getDataType
Returns the data type describing thisDataObject's properties.- Returns:
- the data type describing this
DataObject's properties.
-
getListSize
@Nullable public Long getListSize(@NotNull DataPropertyPath propertyPath) throws IllegalArgumentException Returns the element count of a list-typed property.- Parameters:
propertyPath- the path to the list-typed property.- Returns:
- no value if the list is unset, or the element count otherwise (0 for an empty list).
- Throws:
IllegalArgumentException- if the path's origin type does not match, or the path does not point to a list.
-
getListSize
Convenience overload of getListSize that resolves the property by name on this data object's data type.Equivalent to calling getListSize with a
DataPropertyPathbuilt fromgetDataType()and propertyName.Performance note: this overload resolves the name on every call. To read the same property from many data objects in a tight loop, build a
DataPropertyPathonce and use theDataPropertyPathoverload, which prevents the repeated lookup.- Parameters:
propertyName- the name of a list-typed property in this data object's data type.- Returns:
- no value if the list is unset, or the element count otherwise (0 for an empty list).
- Throws:
IllegalArgumentException- when no property with that name exists, or it does not point to a list.- Since:
- 2026.1
-
hashCode
public int hashCode() -
equals
-
getValue
@Nullable public <T> T getValue(@NotNull DataPropertyPath propertyPath) throws IllegalArgumentException Accesses the value for the given property.The type parameter T depends on the type of value this property contains:
- Scalar property: T is the element type (
bool,int32_t,int64_t,float,double,std::string, or aGeometry, or one of its subtypes). - Composite property (value type is a non-primitive
DataType): T isDataObject, and the nested composite value is returned. - List property: T is the list type, and the list is returned, or no value when the list is unset.
- List element: T is the element type (
DataObjectfor a composite element), and the single element is returned.
- Type Parameters:
T- the value type, chosen by property shape (see above).- Parameters:
propertyPath- the property for which to return a value.- Returns:
- the value, or no value if the property exists but is unset.
- Throws:
IllegalArgumentException- when the path does not match thisDataObject's data type, T does not match the path's leaf type, or the list is unset or the index is out-of-bounds for an indexed path.
- Scalar property: T is the element type (
-
getValue
Convenience overload of getValue that resolves the property by name on this data object's data type.Equivalent to calling getValue with a
DataPropertyPathbuilt fromgetDataType()and propertyName.Performance note: this overload resolves the name on every call. To read the same property from many data objects in a tight loop, build a
DataPropertyPathonce and use theDataPropertyPathoverload, which prevents the repeated lookup.- Type Parameters:
T- the value type, chosen by the property's shape (see theDataPropertyPathoverload).- Parameters:
propertyName- the name of a property in this data object's data type.- Returns:
- the value, or no value if the property exists but is not set.
- Throws:
IllegalArgumentException- when no property with that name exists, or T does not match its type.- Since:
- 2026.1
-