matlab.alias.AliasFileManager Class
Namespace: matlab.alias
Description
The matlab.alias.AliasFileManager
class enables you to create and manage
class alias definitions. The alias definitions map one or more old class names to a new name.
Use this functionality to change the name of an existing class while maintaining compatibility
with code and MAT-files that use the older names of the class. The recommended process for
creating aliases is to write a function to create an instance of
AliasFileManager
.
For more information, see Creating and Managing Class Aliases.
The matlab.alias.AliasFileManager
class is a handle
class.
Creation
Description
creates an fileMgr
= matlab.alias.AliasFileManagerAliasFileManager
instance with no alias definitions.
creates an fileMgr
= matlab.alias.AliasFileManager(location
)AliasFileManager
instance and loads the alias
file in the specified location
. The location
is
the path to the parent folder of the resources
folder containing an
alias definition file. Using this syntax provides a convenient way to view all of the
defined class aliases at location
.
Input Arguments
Properties
Methods
Examples
Tips
The function workflow demonstrated in the examples has the advantage of automatically clearing the instance of
AliasFileManager
.Deprecating old class aliases is not recommended. Removing the old aliases risks compatibility issues for the users of your code. To access an existing alias definition file, use the
fileMgr
=matlab.alias.AliasFileManager
(location
) constructor and read itsAliases
property.When a function and a class alias have the same name, introspection identifies the alias even if the function would otherwise have precedence. For example, if there is a function named
MyOldClass.m
and a class that has"MyOldClass"
as an alias, the statementmc = matlab.metadata.Class.fromName('MyOldClass');
returns a metaclass instance of the class that defines the alias, even if the function has precedence because of path order.
Version History
Introduced in R2021b