Main Content

matlab.metadata.Event Class

Namespace: matlab.metadata
Superclasses: matlab.metadata.MetaData

Describe event defined by MATLAB class

Renamed from meta.event in R2024a

Description

The matlab.metadata.Event class provides information about MATLAB® class events. Properties of the matlab.metadata.Event class correspond to event attributes and other information that is specified syntactically in the class definition. All properties are read-only.

The matlab.metadata.Event class is a handle class.

Class Attributes

Abstract
true
ConstructOnLoad
true

For information on class attributes, see Class Attributes.

Creation

You cannot instantiate a matlab.metadata.Event object directly. Obtain a matlab.metadata.Event object from the matlab.metadata.Class EventList property, which contains an array of matlab.metadata.Event objects, one for each event defined for the class. For example, replace ClassName with the name of the class whose events you want to query:

mco = ?ClassName;
elist = mco.EventList;
elist(1); % matlab.metadata.Event for first event in list

Use the metaclass function to obtain a matlab.metadata.Class object from a class instance:

mco = metaclass(obj);

Properties

expand all

Name of the event, returned as a character vector.

Short description of the event, returned as a character vector. For user-defined classes, the text for this property comes from code comments in the event definition. If there are no comments, the property returns an empty character vector. For more information on how to include help text for your class events, see Custom Help Text.

Detailed description of the event, returned as a character vector. For user-defined classes, the text for this property comes from code comments in the event definition. If there are no comments, the property returns an empty character vector. For more information on how to include help text for your class events, see Custom Help Text.

Value of event attribute Hidden, returned as a logical value. If true, the event does not appear in the list of events returned by the events function (or other event listing functions or viewers).

What code can listen to this event, returned as:

  • public — unrestricted access

  • protected — access from methods in class or subclasses

  • private — access by class methods only (not from subclasses)

  • List of classes that have listen access to this event, specified as matlab.metadata.Class objects in the form:

    • A single matlab.metadata.Class object.

    • A cell array of matlab.metadata.Class objects. An empty cell array, {}, is the same as private access.

    For more information, see Event Access List.

What code can trigger this event, returned as:

  • public — any code can trigger event

  • protected — can trigger event from methods in class or subclasses

  • private — can trigger event by class methods only (not from subclasses)

  • List of classes that have notify access to this event. Specify classes as matlab.metadata.Class objects in the form:

    • A single matlab.metadata.Class object.

    • A cell array of matlab.metadata.Class objects. An empty cell array, {}, is the same as private access.

    For more information, see Event Access List

Class that defines this event, returned as a matlab.metadata.Class object.

Examples

Find Event NotifyAccess

Find what code can trigger the ObjectBeingDestroyed event of the matlab.mixin.Copyable class. Use the matlab.metadata.Event object to determine the event NotifyAccess.

mc = ?matlab.mixin.Copyable;
findobj(mc.EventList,"Name","ObjectBeingDestroyed").NotifyAccess
ans =

    'private'

Version History

Introduced in R2008a

expand all