search: keywords: ['Java API', 'ODatabaseDocument', 'class', 'OClass', 'create class if not exists', 'createClassIfNotExists']

ODatabaseDocument - createClassIfNotExists()

This method creates a new database class if the given name does not already exist.

Creating Database Classes

OrientDB borrows from the Object Oriented programming paradigm the concept of classes, which in these Reference pages is called a database class, to avoid confusion with classes in Java. Internally, each database class is an instance of OClass. Using this method, you can create new database classes on the database, when the given name doesn't exist already.

Syntax

default OClass ODatabaseDocument().createClassIfNotExist(
      String name,
	  String... superclasses)
ArgumentTypeDescription
nameStringDefines the database class name
superclassesStringDefines the superclass the new class belongs to

Return Value

This method returns an OClass instance for the database class.