Annotations
On this page
Dana uses annotations to resolve inheritance or some patterns like singleton declaration.
@component
JSDoc declaration
A component declare an abstract class/model that must be implemented. Jsdoc declaration:
/**
* MyComponentClass
* @class
* ...
* @component
*/Resolved configuration
"MyComponent":{ "implementation": "wiztivi.vendors.XXX.MyComponentClass" }@implementation
An implementation is a class that implements an abstract class. When a class is marked with the @implementation, we loop on the class hierarchy to discover the following annotations:
@service@manager@model@componentAs soon as one of these annotations is found, the founded annotation is applied to the class and the loop is stopped.
JSDoc declaration
/**
* MyImplementationClass
* @class
* ...
* @implementation
*/Resolved configuration
Depends on the founded annotation.
@service
A service is a singleton that defines and implements a service. A service is inheritable, and so will be reached with the @implementation annotation (see above).
JSDoc declaration
/**
* MyServiceClass
* @class
* ...
* @service
*/Resolved configuration
"MyService":{ "implementation": "wiztivi.vendors.XXX.MyServiceClass", "singleton": "myService" }@manager
A manager is a singleton that defines and implements a manager.
A manager is inheritable, and so will be reached with the @implementation annotation (see above).
JSDoc declaration
/**
* MyManagerClass
* @class
* ...
* @manager
*/Resolved configuration
"MyManager":{ "implementation": "wiztivi.vendors.XXX.MyManagerClass", "singleton": "myManager" }@model
A model is a component that defines a model. A model is a javascript object that store properties, and sometimes specific data that comes from vendors API.
A model is inheritable, and so will be reached with the @implementation annotation (see above).
JSDoc declaration
/**
* MyModelClass
* @class
* ...
* @model
*/Resolved configuration
"MyModel":{ "implementation": "wiztivi.vendors.XXX.MyModelClass" }@singleton
A singleton declares a component that will have a unique instance during all the life of the application. A singleton is not inheritable, and so won’t be reached with the @implementation annotation (see above).
JSDoc declaration
/**
* MySingletonClass
* @class
* ...
* @singleton
*/Resolved configuration
"MySingleton":{ "implementation": "wiztivi.vendors.XXX.MySingletonClass", "singleton": "mySingleton" }