Interface ORecordSchemaAware
- All Known Implementing Classes:
ODocument,ODocumentEmbedded,OEdgeDocument,OVertexDocument,OViewDocument
public interface ORecordSchemaAware
Generic record representation with a schema definition. The record has multiple fields. Fields
are also called properties.
-
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsField(String iFieldName) Tells if a field is contained in current record.<RET> RETReturns the value of a field.<RET> RETReturns the value of a field forcing the return type.Sets the value for a field.Sets the value for a field forcing the type.This is useful when you want avoid automatic conversions (for example record id to record) or need expressly a conversion between types.String[]Returns the record's field names.intfields()Returns the number of fields present in memory.Object[]Returns the record's field values.Returns the class name associated to the current record.Returns the schema class object for the record.removeField(String iFieldName) Removes a field.voidsetClassName(String iClassName) Sets the class for the current record.voidsetClassNameIfExists(String iClassName) Sets the class for the current record only if already exists in the schema.voidvalidate()Validates the record against the schema constraints if defined.
-
Method Details
-
field
Returns the value of a field.- Parameters:
iFieldName- Field name- Returns:
- Field value if exists, otherwise null
-
field
Returns the value of a field forcing the return type. This is useful when you want avoid automatic conversions (for example record id to record) or need expressly a conversion between types.- Parameters:
iFieldName- Field nameiType- Type between the values defined in theOTypeenum- Returns:
- Field value if exists, otherwise null
-
field
Sets the value for a field.- Parameters:
iFieldName- Field nameiFieldValue- Field value to set- Returns:
- The Record instance itself giving a "fluent interface". Useful to call multiple methods in chain.
-
field
Sets the value for a field forcing the type.This is useful when you want avoid automatic conversions (for example record id to record) or need expressly a conversion between types.- Parameters:
iFieldName- Field nameiFieldValue- Field value to setiType- Type between the values defined in theOTypeenum- Returns:
-
removeField
Removes a field. This operation does not set the field value to null but remove the field itself.- Parameters:
iFieldName- Field name- Returns:
- The old value contained in the remove field
-
containsField
Tells if a field is contained in current record.- Parameters:
iFieldName- Field name- Returns:
- true if exists, otherwise false
-
fields
int fields()Returns the number of fields present in memory.- Returns:
- Fields number
-
fieldNames
String[] fieldNames()Returns the record's field names. The returned Set object is disconnected by internal representation, so changes don't apply to the record. If the fields are ordered the order is maintained also in the returning collection.- Returns:
- Set of string containing the field names
-
fieldValues
Object[] fieldValues()Returns the record's field values. The returned object array is disconnected by internal representation, so changes don't apply to the record. If the fields are ordered the order is maintained also in the returning collection.- Returns:
- Object array of the field values
-
getClassName
String getClassName()Returns the class name associated to the current record. Can be null. Call this method after ato re-associate the class.invalid reference
#reset()- Returns:
- Class name if any
-
setClassName
Sets the class for the current record. If the class not exists, it will be created in transparent way as empty (no fields).- Parameters:
iClassName- Class name to set
-
setClassNameIfExists
Sets the class for the current record only if already exists in the schema.- Parameters:
iClassName- Class name to set
-
getSchemaClass
OClass getSchemaClass()Returns the schema class object for the record.- Returns:
OClassinstance or null if the record has no class associated
-
validate
Validates the record against the schema constraints if defined. If the record breaks the validation rules, then aOValidationExceptionexception is thrown.- Throws:
OValidationException
-