MATLAB Object-Oriented Programming

(Joyce) #1
Search the MethodList list of meta.method objects for those methods that have their
Abstract property set to true:

absMethods = findobj(mc.MethodList,'Abstract',true);
methodNames = {absMethods.Name};

The cell array, methodNames, contains the names of the abstract methods in the class.

Find Properties That Have Public Get Access

Find the names of all properties in the containers.Map class that have public
GetAccess:


  • Get the meta.class object.

  • Use findobj to search the array of meta.property objects.

  • Use braces to create a cell array of property names.


mc = ?containers.Map;
mpArray = findobj(mc.PropertyList,'GetAccess','public');
names = {mpArray.Name};

Display the names of all containers.Map properties that have public GetAccess:

celldisp(names)

names{1} =

Count

names{2} =

KeyType

names{3} =

ValueType

Find Static Methods

Determine if any containers.Map class methods are static:

~isempty(findobj([mc.MethodList(:)],'Static',true))

16 Information from Class Metadata

Free download pdf