Add tags and metadata programmatically

I’m currently developing a binding for things that should be voice controlled by Alexa (and/or HomeKit). Instead of adding the necessary metadata and tags by hand, I want to add them in my handler code. I have seen that tags can be added to GenericItems. Can tags be added to ChannelGroups, too?
I have not found a way to add metadata, like described on the Items Documentation Page programmatically. How can I achive that?

Take a look at hueemulation… it adds a HUEEMU namespace to Items.

As for ChannelGroups, I don’t think so, but I’m not 100%.

Thanks!
I can not find documentation for org.eclipse.smarthome.core.items.Metadata on the Eclipse Smarthome API Documentation. Is there any other place the meta classes are documented?

Not TMK… just in the code. There aren’t too many classes to go through.

your code goes here

openHAB no longer derives from Eclipse Smarthome and all documentation has been reintegrated already. So best look at openhab.org/docs first. The metadata part hasn’t been documented. I’m the author of the linked hueemu code and also only had the code classes as reference.

There’s one other consumer of item metadata which is the item auto-update functionality.