Attribute Mapping: Programmatically Establishing Defaults
A Java-based resource provider class can initialize the mapping of its attributes by calling the addMapping() method in its overridden initializeThing() method.
For example, ThingBasedResourceProvider (described below) forces the mapping of "name" property on a thing to the "Id" attribute for its asset resource, by passing true to addMapping method. In addition, it initializes a mapping from the "name" property on a thing to the "Name" attribute on its represented asset resource.
@Override
    protected void initializeThing() throws Exception {
        addMapping(ID_PROPERTY, "name", BaseTypes.STRING, true); // Map name of each Thing to Id
        addMapping(NAME_PROPERTY, "name", BaseTypes.STRING, false); // Map name of each Thing to Name

        super.initializeThing();
    }