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

MethodReturn TypeDescription
addSuperClass()OClassAdds a superclass to the database class
count()LongCounts 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()booleanDetermines whether the class has superclasses
isEdgeType()booleanDetermines whether the class is an edge
isVertexType()booleanDetermines whether the class is a vertex
removeSuperClass()OClassRemoves a superclass from the class
setName()OClassSets the class name

Managing Clusters

MethodReturn TypeDescription
addCluster()OClassAdds a cluster to the database class, by its name
addClusterId()OClassAdd a cluster to the database class, by its Cluster ID
getClusterIdsint[]Retrieves ID's for clusters on the class
getDefaultClusterId()intRetrieves the default Cluster ID
hasClusterId()booleanDetermines whether the class uses the given Cluster ID
hasPolymorphicClusterId()booleanDetermines whether the class or any superclasses of the class use the given Cluster ID
setDefaultClusterId()voidConfigures the default cluster, by Cluster ID
removeClusterId()OClassRemoves a Cluster ID
truncate()voidRemoves all data from all clusters on the class
truncateCluster()OClassRemoves all data in cluster with the given name

Managing Properties

MethodReturn TypeDescription
createProperty()OPropertyCreates a property (that is, a field) on the class
dropProperty()voidRemoves property from class
existsProperty()booleanDetermines whether a property exists on the class
getIndexedProperties()Collection <OProperty>Retrieves a collection of properties that are indexed
getProperty()OPropertyRetrieves the given property
properties()Collection<OProperty>Retrieves properties on the class
propertiesMap()Map <String, OProperty>Retrieves properties on the class

Managing Indexes

MethodReturn TypeDescription
areIndexed()BooleanDetermines 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