intf ? InterfaceDef.class : ComponentDef.class);
Source<?> source = Aura.getContextService().getCurrentContext().getDefRegistry().getSource(desc);
// checks for an empty attribute name or type
if ("".equals(attName) || "".equals(type)) {
throw new AuraRuntimeException("Cannot leave the field blank");
}
// Validates the attribute name
if ((AuraTextUtil.validateAttributeName(attName)) != true) {
throw new AuraRuntimeException("Invalid attribute name:'" + attName
+ "',Refer to Auradocs for valid attribute names");
}
// validates the type
try {
DefDescriptor<TypeDef> typeDesc = Aura.getDefinitionService().getDefDescriptor(type, TypeDef.class);
typeDesc.getDef();
} catch (AuraRuntimeException e) {
throw new AuraRuntimeException("Invalid attribute type:" + type);
}
if (!source.exists()) {
throw new AuraError("Cannot find source for " + desc.getQualifiedName());
}