Constructor allows attribute->property mapping to be overriden.
Two arrays are passed in.
One contains the attribute names and the other the property names.
The attribute name / property name pairs are match by position
In order words, the first string in the attribute name list matches
to the first string in the property name list and so on.
If a property name is null or the attribute name has no matching
property name, then this indicates that the attibute should be ignored.
Example One
The following constructs a rule that maps the alt-city
attribute to the city
property and the alt-state
to the state
property.
All other attributes are mapped as usual using exact name matching.
SetPropertiesRule(
new String[] {"alt-city", "alt-state"},
new String[] {"city", "state"});
Example Two
The following constructs a rule that maps the class
attribute to the className
property.
The attribute ignore-me
is not mapped.
All other attributes are mapped as usual using exact name matching.
SetPropertiesRule(
new String[] {"class", "ignore-me"},
new String[] {"className"});
// create local copies
this.attributeNames = new String[attributeNames.length];
for (int i=0, size=attributeNames.length; i<size; i++) {
this.attributeNames[i] = attributeNames[i];
}
this.propertyNames = new String[propertyNames.length];
for (int i=0, size=propertyNames.length; i<size; i++) {
this.propertyNames[i] = propertyNames[i];
}