DefType defType = descriptor.getDefType();
switch (defType) {
case APPLICATION:
return (T) new ApplicationImpl((DefDescriptor<ApplicationDef>) descriptor, attributes);
case COMPONENT:
return (T) new ComponentImpl((DefDescriptor<ComponentDef>) descriptor, attributes);
case ACTION:
AuraContext context = Aura.getContextService().getCurrentContext();
context.pushCallingDescriptor(descriptor);