Main Content

meta.event class

Package: meta
Superclasses: meta.MetaData

Describe event defined by MATLAB class

Description

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

The meta.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 meta.event object directly. Obtain a meta.event object from the meta.class EventList property, which contains an array of meta.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); % meta.event for first event in list

Use the metaclass function to obtain a meta.class object from a class instance:

mco = metaclass(obj);

Properties

expand all

Name of the event, returned as a character vector.

Example: ObjectBeingDestroyed

Data Types: char

Currently not used to collect information about the event from comments.

Data Types: char

Currently not used to collect information about the event from comments.

Data Types: char

Is this event 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).

Example: events (Hidden = true)

Data Types: logical

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 classes that have listen access to this event. Specify classes as meta.class objects in the form:

    • A single meta.class object

    • A cell array of meta.class objects. An empty cell array, {}, is the same as private access.

    For more information, see Event Access List

Example: events (ListenAccess = protected)

Data Types: enumerated | meta.class array

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 classes that have notify access to this event. Specify classes as meta.class objects in the form:

    • A single meta.class object

    • A cell array of meta.class objects. An empty cell array, {}, is the same as private access.

    For more information, see Event Access List

Example: events (NotifyAccess = private)

Data Types: enumerated | meta.class

Class that defines this event, returned as a meta.class object.

Data Types: meta.class

Examples

Find Event NotifyAccess

Find what code can trigger the matlab.mixin.Copy class ObjectBeingDestroyed event. Use the meta.event object to determine the event NotifyAccess.

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

    'private'
Introduced in R2008a