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

See also

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
getModelFile ModelFile Returns the ModelFile that defines 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.

See also

Parameters

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

getModelFile

ModelFile getModelFile( )

Returns the ModelFile that defines this class.

Returns

ModelFile - the owning ModelFile

See also

Parameters

No parameters

_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.

See also

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

See also

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

See also

Parameters

No parameters

isEnum

boolean isEnum( )

Returns true if this class is an enumeration.

Returns

boolean - true if the class is an enumerated type

See also

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

See also

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

See also

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

See also

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

See also

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

See also

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

See also

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

See also

Parameters

No parameters

getNamespace

String getNamespace( )

Return the namespace of this class.

Returns

String - namespace - a namespace.

See also

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

See also

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

See also

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.

See also

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

See also

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

See also

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.

See also

Parameters

No parameters

getAssignableClassDeclarations

ClassDeclaration[] getAssignableClassDeclarations( )

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

Returns

ClassDeclaration - subclass declarations.

See also

Parameters

No parameters

getAllSuperTypeDeclarations

ClassDeclaration[] getAllSuperTypeDeclarations( )

Get all the super-type declarations for this type.

Returns

ClassDeclaration - super-type declarations.

See also

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

See also

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

See also

Parameters

No parameters

getNestedProperty

Property getNestedProperty( string propertypath )

Get a nested property using a dotted property path

Returns

Property - the property

See also

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

See also

Parameters

No parameters

Inherited methods