search: keywords: ['Java API', 'OClass' ]
Java API - OClass
This class provides a standard interface for handling database classes.
Managing Database Classes
OrientDB draws from the Object Oriented programming paradigm in the concept of a class, which for the prposes of clarity is called a database class in this Reference guide, to avoid confusion with classes in Java. Database classes are loosely comparable with tables in Relational databases. But, unlike tables, database classes are not required to follow a schema unless you want them to follow a schema. In Java, database classes implement the OClass
class.
This class is available at com.orientechnologies.orient.core.metadata.schema
.
import com.orientechnologies.orient.core.metadata.schema.OClass;
Once you've imported the class to your application, you can use to build particular instances in your code.
Methods
Managing Classes
Method | Return Type | Description |
---|---|---|
addSuperClass() | OClass | Adds a superclass to the database class |
count() | Long | Counts the number of records in the class |
getAllSubclasses() | Collection <OClass> | Retrieves classes that use this class as thier superclass, and subclasses of these classes, (the complete hierarchy) |
getAllSuperClasses() | Collection <OClass> | Retrives all superclasses of this class |
getSubclasses() | Collection <OClass> | Retrieves classes that use this class as their immediate superclass, (one level hierarchy) |
getSuperClassesNames() | List <String> | Retrieves the names of all superclasses for this class |
hasSuperClasses() | boolean | Determines whether the class has superclasses |
isEdgeType() | boolean | Determines whether the class is an edge |
isVertexType() | boolean | Determines whether the class is a vertex |
removeSuperClass() | OClass | Removes a superclass from the class |
setName() | OClass | Sets the class name |
Managing Clusters
Method | Return Type | Description |
---|---|---|
addCluster() | OClass | Adds a cluster to the database class, by its name |
addClusterId() | OClass | Add a cluster to the database class, by its Cluster ID |
getClusterIds | int[] | Retrieves ID's for clusters on the class |
getDefaultClusterId() | int | Retrieves the default Cluster ID |
hasClusterId() | boolean | Determines whether the class uses the given Cluster ID |
hasPolymorphicClusterId() | boolean | Determines whether the class or any superclasses of the class use the given Cluster ID |
setDefaultClusterId() | void | Configures the default cluster, by Cluster ID |
removeClusterId() | OClass | Removes a Cluster ID |
truncate() | void | Removes all data from all clusters on the class |
truncateCluster() | OClass | Removes all data in cluster with the given name |
Managing Properties
Method | Return Type | Description |
---|---|---|
createProperty() | OProperty | Creates a property (that is, a field) on the class |
dropProperty() | void | Removes property from class |
existsProperty() | boolean | Determines whether a property exists on the class |
getIndexedProperties() | Collection <OProperty> | Retrieves a collection of properties that are indexed |
getProperty() | OProperty | Retrieves the given property |
properties() | Collection <OProperty> | Retrieves properties on the class |
propertiesMap() | Map <String, OProperty> | Retrieves properties on the class |
Managing Indexes
Method | Return Type | Description |
---|---|---|
areIndexed() | Boolean | Determines whether the given fields are contained as first key fields in the database class indexes |
createIndex() | OIndex<?> | Creates an index on the given property |
getAutoShardingIndex() | OIndex<?> | Retrieves the auto sharding index configured for the class, if any |
getClassIndex() | OIndex<?> | Retrieves the requested index instance |
getClassIndexes() | Set <OIndex<?>> | Retrieves indexes for the class |
getClassInvolvedIndexes() | Set <OIndex<?>> | Retrieves indexes that include the given properties as first keys |
getIndexedProperties() | Collection <OProperty> | Retrieves a collection of properties that are indexed |