ClassDeclaration (Common API)

Overview - Common API - Client API - Admin API - Runtime API

ClassDeclaration

ClassDeclaration defines the structure (model/schema) of composite data. It is composed of a set of Properties, may have an identifying field, and may have a super-type. A ClassDeclaration is conceptually owned by a ModelFile which defines all the classes that are part of a namespace.

Details

  • Module common

Method Summary

Name Returns Description
_resolveSuperType ClassDeclaration Resolve the super type on this class and store it as an internal property
constructor void Create a ClassDeclaration from an Abstract Syntax Tree
getAllSuperTypeDeclarations ClassDeclaration[] Get all the super-type declarations for this type
getAssignableClassDeclarations ClassDeclaration[] Get the class declarations for all subclasses of this class, including this class
getFullyQualifiedName string Returns the fully qualified name of this class
getIdentifierFieldName string Returns the name of the identifying field for this class
getName string Returns the short name of a class
getNamespace String Return the namespace of this class
getNestedProperty Property Get a nested property using a dotted property path
getOwnProperties Property[] Returns the fields directly defined by this class
getOwnProperty Property Returns the field with a given name or null if it does not exist
getProperties Property[] Returns the properties defined in this class and all super classes
getProperty Property Returns the property with a given name or null if it does not exist
getSuperType string Returns the FQN of the super type for this class or null if this class does not have a super type
getSuperTypeDeclaration ClassDeclaration Get the super type class declaration for this class
getSystemType string Returns the base system type for this type of class declaration
isAbstract boolean Returns true if this class is declared as abstract in the model file
isConcept boolean Returns true if this class is the definition of a concept
isEnum boolean Returns true if this class is an enumeration
isEvent boolean Returns true if this class is the definition of an event
isRelationshipTarget boolean Returns true if this class can be pointed to by a relationship
isSystemCoreType boolean Returns true if this class is a system core type - both in the system namespace, and also one of the system core types (Asset, Participant, etc)
isSystemRelationshipTarget boolean Returns true if this class can be pointed to by a relationship in a system model
isSystemType boolean Returns true is this type is in the system namespace
toString String Returns the string representation of this class

Method Details

new ClassDeclaration()

Create a ClassDeclaration from an Abstract Syntax Tree. The AST is the result of parsing.

Parameters

Name Type Mandatory Description
modelFile ModelFile Yes the ModelFile for this class
ast string Yes the AST created by the parser

_resolveSuperType

ClassDeclaration _resolveSuperType( )

Resolve the super type on this class and store it as an internal property.

Returns

ClassDeclaration - The super type, or null if non specified.

Parameters

No parameters

getSystemType

string getSystemType( )

Returns the base system type for this type of class declaration. Override this method in derived classes to specify a base system type.

Returns

string - the short name of the base system type or null

Parameters

No parameters

isAbstract

boolean isAbstract( )

Returns true if this class is declared as abstract in the model file

Returns

boolean - true if the class is abstract

Parameters

No parameters

isEnum

boolean isEnum( )

Returns true if this class is an enumeration.

Returns

boolean - true if the class is an enumerated type

Parameters

No parameters

isConcept

boolean isConcept( )

Returns true if this class is the definition of a concept.

Returns

boolean - true if the class is a concept

Parameters

No parameters

isEvent

boolean isEvent( )

Returns true if this class is the definition of an event.

Returns

boolean - true if the class is an event

Parameters

No parameters

isRelationshipTarget

boolean isRelationshipTarget( )

Returns true if this class can be pointed to by a relationship

Returns

boolean - true if the class may be pointed to by a relationship

Parameters

No parameters

isSystemRelationshipTarget

boolean isSystemRelationshipTarget( )

Returns true if this class can be pointed to by a relationship in a system model

Returns

boolean - true if the class may be pointed to by a relationship

Parameters

No parameters

isSystemType

boolean isSystemType( )

Returns true is this type is in the system namespace

Returns

boolean - true if the class may be pointed to by a relationship

Parameters

No parameters

isSystemCoreType

boolean isSystemCoreType( )

Returns true if this class is a system core type - both in the system namespace, and also one of the system core types (Asset, Participant, etc).

Returns

boolean - true if the class may be pointed to by a relationship

Parameters

No parameters

getName

string getName( )

Returns the short name of a class. This name does not include the namespace from the owning ModelFile.

Returns

string - the short name of this class

Parameters

No parameters

getNamespace

String getNamespace( )

Return the namespace of this class.

Returns

String - namespace - a namespace.

Parameters

No parameters

getFullyQualifiedName

string getFullyQualifiedName( )

Returns the fully qualified name of this class. The name will include the namespace if present.

Returns

string - the fully-qualified name of this class

Parameters

No parameters

getIdentifierFieldName

string getIdentifierFieldName( )

Returns the name of the identifying field for this class. Note that the identifying field may come from a super type.

Returns

string - the name of the id field for this class

Parameters

No parameters

getOwnProperty

Property getOwnProperty( string name )

Returns the field with a given name or null if it does not exist. The field must be directly owned by this class -- the super-type is not introspected.

Returns

Property - the field definition or null if it does not exist.

Parameters

Name Type Mandatory Description
name string Yes the name of the field

getOwnProperties

Property[] getOwnProperties( )

Returns the fields directly defined by this class.

Returns

Property - the array of fields

Parameters

No parameters

getSuperType

string getSuperType( )

Returns the FQN of the super type for this class or null if this class does not have a super type.

Returns

string - the FQN name of the super type or null

Parameters

No parameters

getSuperTypeDeclaration

ClassDeclaration getSuperTypeDeclaration( )

Get the super type class declaration for this class.

Returns

ClassDeclaration - the super type declaration, or null if there is no super type.

Parameters

No parameters

getAssignableClassDeclarations

ClassDeclaration[] getAssignableClassDeclarations( )

Get the class declarations for all subclasses of this class, including this class.

Returns

ClassDeclaration - subclass declarations.

Parameters

No parameters

getAllSuperTypeDeclarations

ClassDeclaration[] getAllSuperTypeDeclarations( )

Get all the super-type declarations for this type.

Returns

ClassDeclaration - super-type declarations.

Parameters

No parameters

getProperty

Property getProperty( string name )

Returns the property with a given name or null if it does not exist. Fields defined in super-types are also introspected.

Returns

Property - the field, or null if it does not exist

Parameters

Name Type Mandatory Description
name string Yes the name of the field

getProperties

Property[] getProperties( )

Returns the properties defined in this class and all super classes.

Returns

Property - the array of fields

Parameters

No parameters

getNestedProperty

Property getNestedProperty( string propertypath )

Get a nested property using a dotted property path

Returns

Property - the property

Parameters

Name Type Mandatory Description
propertyPath string Yes The property name or name with nested structure e.g a.b.c

toString

String toString( )

Returns the string representation of this class

Returns

String - the string representation of the class

Parameters

No parameters

Inherited methods