logger.error("In " + this + ", attribute\"" + attr
+ "\" is reserved");
return null;
}
PropertyDefinition definition = this.getAttrDefinition(attr);
if (definition == null ) {
logger.error("In " + this + ", attribute \"" + attr
+ "\" is undefined.");
return null;
}
/*
* Internal field attributes cannot be set
*/
if (definition.getInjected() == InjectedPropertyPolicy.INTERNAL && !forced) {
logger.error("In " + this + ", attribute \"" + attr
+ "\" is an internal field attribute and cannot be set.");
return null;
}
/*
* if the same attribute exists above, it is a redefinition.
*/
ComponentImpl group = (ComponentImpl) this.getGroup();
if (group != null && group.get(attr) != null) {
Object groupValue = group.get(attr);
String defaultValue = definition.getDefaultValue();
boolean isDefault = defaultValue != null &&
groupValue.equals(Attribute.checkAttrType(attr,defaultValue,definition.getType()));
// If the attribute above is the default value, it is allowed to change it
if (!isDefault && !Attribute.isBuiltAttribute(attr)) {
logger.error("In " + this + ", cannot redefine attribute \"" + attr + "\"");
return null;