Reputation: 25373
I am working on adding some common functionality to a potentially large set of diverse custom controls.
To surface my configuration-driven functionality, I was thinking an elegant way could be to add custom members to the "metadata" section of a control's definition.
For example, something like this:
sap.ui.core.Control.extend("myCompany.foo.FooControl", {
metadata: {
// normal stuff, properties, aggregation, etc...
properties: {
},
...
// my custom stuff
custom: {
}
}
});
Is there a best practice way of adding custom content to the metadata object? Or, is there a way to get a hold of this object literal at runtime so I could at least parse it for my custom attributes?
Upvotes: 2
Views: 3229
Reputation: 2473
I dont believe you can add you own kind of metadata to a managed object the values look fixed
sap.ui.base.ManagedObjectMetadata.Kind = {
PROPERTY :0, SINGLE_AGGREGATION : 1, MULTIPLE_AGGREGATION : 2,
SINGLE_ASSOCIATION : 3, MULTIPLE_ASSOCIATION : 4, EVENT : 5
};
to access the metadata of an object you can use the getter getMetadata -eg
myControl.getMetadata();
Upvotes: 1