www.gusucode.com > appdesigner工具箱matlab源码程序 > appdesigner/+appdesigner/+internal/+application/+appmetadata/createComponentAdapterMap.m

    function adapterMap = createComponentAdapterMap()
    %CREATECOMPONENTADAPTERMAP create a map of all component adapters registered
    % in the App Designer Design Environment

    % find all the registered component adapter classes that are in
    % the 'appdesigner.internal.componentadapter' package and extend
    % from 'appdesigner.internal.componentadapterapi.ComponentRegistration'.
    % The list returned contains metaclasses of the adapters
    
    %   Copyright 2015 The MathWorks, Inc.
    
    metaClasses = internal.findSubClasses( ...
        'appdesigner.internal.componentadapter', ...
        'appdesigner.internal.componentadapterapi.ComponentRegistration', ...
        true);

    % loop over the adapter classes and build the map
    adapterMap = containers.Map;
    for i = 1:length(metaClasses)
        % get the adapter class name
        adapterClassName = metaClasses{i}.Name;

        % Retrieve the adapter's component type.
        type = eval([adapterClassName '.getComponentType']);

        % add the adapter info to the map.  The key is the
        % component type and value is the adapter class name for that type
        adapterMap(type) = adapterClassName;
    end
end