Type to start searching...

Class

A Class is an abstraction of a business model concept.

Description

Maintained in the Classes tab of the Business Model in NexJ Studio.

A Class describes of a set of objects with common structural characteristics (see Attribute) and behaviors (see Event). For example, the class Person may contain relevant shared attributes for all people being considered, such as height and eye color, and behaviors, such as the ability to speak and jump (events). An Instance of a class is a member of the set represented by the class. e.g. "Joe Test: 5"8 - blue eyes"

Class attributes can be primitive (integer, string, ...) or non-primitive if they refer to associated classes within the domain model.

A class' persistence mapping determines how an instance's state is stored when not in memory. Each persisted class specifies how its class attributes will be mapped to to phycical locations in a data source.

Classes support single inheritence and are fully polymorphic. i.e. all of their events are virtual. They are metadata but are interpreted as fully functional objects by the Model Server.

All classes are derived from a common base object - called Object - that provides common functionality and lifecycle events. You can review documentation on Object in the scheme help system by typing Object' and ctrl-space in a scheme editor within NexJ Studio. Also, see the documentation on Class'Events for information about the common events.

Both attributes and events may be static. Statics are available on instances and on the class metadata object.

e.g. Object'read is a static event so (Person'read ...) and (myInstance'read ...) are both valid.

Static attributes are shared between all class instances, with non-static ones are allocated separately for each class instance. Static events can update only shared state, non-static ones update instance state.

There are significant advantages to NexJ classes over generic class sytems, such as Java classes. These advantages include:


   *  NexJ Classes provide multiple-inheritance features through Aspects
   *  NexJ classes are designed specifically to support persisting to data sources and include
       automatic generation of appropriate back-end instructions (such as DBMS specific SQL)
       from a flexible persistance mapping.
   *  All instances are referenced by an Object Identifier (OID) that typically is the primary key
       where the instance is persisted.
   *  NexJ classes use the Event-Condition-Action pattern instead of simple methods
   *  Events may be invoked explicitly by business logic or by RPC calls.
   *  Some events are implicitly raised by the object model.
          - The update event is raised when attributes are updated on an instance.
          - The create event is raised when certain events such as update are called and the instance does not
             yet have an identifier (OID) In this case, any attributes that already have values on the object are
             used as initial values and are acessible in the create event.
   *  NexJ attributes support an explicit initialization script
   *  NexJ attributes may be calculated with an expression configured in their value property
   *  NexJ attributes do not support getter/setter paradigms but allow actions to be invoked when attributes are updated.
   *  NexJ classes do not support traditional contructors, but allow actions to be invoked when a create event occurs. The create
       event is similar to a contructor, but, unlike a contructor, may be called multiple times. For example, if a new instance is
       modified after the instance is initially created but before the instance is committed, the create event is called again, but
       with the new modifications applied.
  

Properties
aspects : aspectList

List of names of aspects to include in or exclude from (if prefixed with !) this class. If an aspect is included, the aspect's attributes and events are appended to this class'.

Valid values based on“token”.
(!?:?[\p{L}_][\p{L}\p{N}_]*(:[\p{L}_][\p{L}\p{N}_]*)*\s+)*(!?:?[\p{L}_][\p{L}\p{N}_]*(:[\p{L}_][\p{L}\p{N}_]*)*)?

Each element in the list must begin with a letter or underscore. Elements are space delimited. To exclude a token, prefix it with the character "!".

base : identifier

Base class, the definition of which is inherited.

Valid values based on“string”.
:?[\p{L}_][\p{L}\p{N}_]*(:[\p{L}_][\p{L}\p{N}_]*)*

Value must begin with a letter or an underscore. Case and length are not restricted. Letters, numbers and underscores are allowed. Colon is used as a scope separator. Spaces and other punctuation characters are not allowed.

caption : string

String indentifier of the user-friendly name of the class.

compatibility : compatibility

Backward compatibility: none|backward|deprecated

"backward" includes the class in the current versioned API. "deprecated" includes the class, but indicates that an alternative is preferred and that it may be excluded from future versions. All compatible members will be marked as "deprecated" on the API. "none" excludes the class from the current versioned API.
Valid values based on“string”.
none
backward
deprecated
description : string

Type description.

facets : string

Facets with values and overrides: <name1> (<name2> <value2> value|list|assoc) ... Override defaults to value if not specified.

nameAttribute : identifier

Attribute that provides the name of the instance, e.g. contact fullName.

Valid values based on“string”.
:?[\p{L}_][\p{L}\p{N}_]*(:[\p{L}_][\p{L}\p{N}_]*)*

Value must begin with a letter or an underscore. Case and length are not restricted. Letters, numbers and underscores are allowed. Colon is used as a scope separator. Spaces and other punctuation characters are not allowed.

transitiveUpdateAudit : boolean

Flag to indicate whether changes propagated to an instance of this class will further be propagated to instances that are observing changes to this instance.

When set to true, instead of using this class instance as the audit context in the audit log, instances observing this instance will be used as audit contexts.
validation : string

Validation expression taking "this" argument and returning #f, a string indentifier or a list of format arguments if the instance is invalid.

visibility : visibility

Public to participate in RPC, protected for in-process use only.

Valid values based on“string”.
public
protected
where : string

Read restriction on the instances of the class.

Content
  • Sequence of:

    • PersistenceMapping [0..1] - A class’ persistence mapping specifies how its instances will be persisted in a given datasource.

  • Sequence of:

    • Attributes [0..1] - Collection of Attributes on a Class or Aspect

    • Events [0..1] - Collection of Events on a Class or Aspect.