@accordproject/concerto-core
Version:
Core Implementation for the Concerto Modeling Language
129 lines (128 loc) • 4.13 kB
TypeScript
declare const Decorated: any;
/**
* Declaration 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 Declaration is conceptually owned by a ModelFile which
* defines all the classes that are part of a namespace.
*
* @abstract
* @class
* @memberof module:concerto-core
*/
declare class Declaration extends Decorated {
/**
* Create a Declaration from an Abstract Syntax Tree. The AST is the
* result of parsing.
*
* @param {ModelFile} modelFile - the ModelFile for this class
* @param {Object} ast - the AST created by the parser
* @throws {IllegalModelException}
*/
constructor(modelFile: any, ast: any);
/**
* Process the AST and build the model
*
* @throws {IllegalModelException}
* @private
*/
process(): void;
/**
* Semantic validation of the structure of this decorated. Subclasses should
* override this method to impose additional semantic constraints on the
* contents/relations of fields.
*
* @param {...*} args the validation arguments
* @throws {IllegalModelException}
* @protected
*/
validate(...args: any[]): void;
/**
* Determines whether a type name resolves to a reserved type in the Concerto
* system namespace.
* @param {ModelFile} modelFile - the current model file
* @param {string} typeName - local/imported type name
* @returns {boolean} true if the resolved import is a reserved system type
*/
private isReservedSystemTypeImport;
/**
* Returns the ModelFile that defines this class.
*
* @public
* @return {ModelFile} the owning ModelFile
*/
getModelFile(): any;
/**
* Returns the short name of a class. This name does not include the
* namespace from the owning ModelFile.
*
* @return {string} the short name of this class
*/
getName(): any;
/**
* Return the namespace of this class.
* @return {string} namespace - a namespace.
*/
getNamespace(): any;
/**
* Returns the fully qualified name of this class.
* The name will include the namespace if present.
*
* @return {string} the fully-qualified name of this class
*/
getFullyQualifiedName(): any;
/**
* Returns false as scalars are never identified.
* @returns {Boolean} false as scalars are never identified
*/
isIdentified(): boolean;
/**
* Returns false as scalars are never identified.
* @returns {Boolean} false as scalars are never identified
*/
isSystemIdentified(): boolean;
/**
* Returns the name of the identifying field for this class. Note
* that the identifying field may come from a super type.
*
* @return {string} the name of the id field for this class or null if it does not exist
*/
getIdentifierFieldName(): null;
/**
* Returns the FQN of the super type for this class or null if this
* class does not have a super type.
*
* @return {string} the FQN name of the super type or null
*/
getType(): null;
/**
* Returns the string representation of this class
* @return {String} the string representation of the class
*/
toString(): string | null;
/**
* Returns true if this class is the definition of an enum.
*
* @return {boolean} true if the class is an enum
*/
isEnum(): boolean;
/**
* Returns true if this class is the definition of a class declaration.
*
* @return {boolean} true if the class is a class
*/
isClassDeclaration(): boolean;
/**
* Returns true if this class is the definition of a scalar declaration.
*
* @return {boolean} true if the class is a scalar
*/
isScalarDeclaration(): boolean;
/**
* Returns true if this class is the definition of a map-declaration.
*
* @return {boolean} true if the class is a map-declaration
*/
isMapDeclaration(): boolean;
}
export = Declaration;