private void set(AttributeDefRef attributeDefRef) throws QuickFixException {
RootDefinition def = rootDefDescriptor.getDef();
Map<DefDescriptor<AttributeDef>, AttributeDef> attributeDefs = def.getAttributeDefs();
AttributeDef attributeDef = attributeDefs.get(attributeDefRef.getDescriptor());
// setAndValidateAttribute should be merged with creating the
// AttributeImpl here
AttributeImpl attribute;
if (attributeDef == null) {
Map<String, RegisterEventDef> events = def.getRegisterEventDefs();
if (events.containsKey(attributeDefRef.getDescriptor().getName())) {
EventHandlerImpl eh = new EventHandlerImpl(attributeDefRef.getDescriptor().getName());
Object o = attributeDefRef.getValue();
if (!(o instanceof PropertyReference)) {
// FIXME: where are we?
throw new InvalidDefinitionException(String.format("%s no can haz %s", eh.getName(), o),
SUPER_PASSTHROUGH);
}
eh.setActionExpression((PropertyReference) o);
set(eh);
return;
} else {
// FIXME: where are we?
throw new AttributeNotFoundException(rootDefDescriptor, attributeDefRef.getName(), SUPER_PASSTHROUGH);
}
} else {
attribute = new AttributeImpl(attributeDef.getDescriptor());
}
Object value = attributeDefRef.getValue();
InstanceStack iStack = Aura.getContextService().getCurrentContext().getInstanceStack();
iStack.markParent(parent);
iStack.setAttributeName(attributeDef.getDescriptor().toString());
value = attributeDef.getTypeDef().initialize(value, valueProvider);
iStack.clearAttributeName(attributeDef.getDescriptor().toString());
iStack.clearParent(parent);
attribute.setValue(value);
set(attribute);
}