AuraContext context = Aura.getContextService().getCurrentContext();
BaseComponent<?, ?> component = context.getCurrentComponent();
String desc = (String) component.getAttributes().getValue("descriptor");
DefType defType = DefType.valueOf(((String) component.getAttributes().getValue("defType")).toUpperCase());
DefDescriptor<? extends Definition> descriptor = null;
if (defType != DefType.INCLUDE) {
// Nominal case:
descriptor = Aura.getDefinitionService().getDefDescriptor(desc, defType.getPrimaryInterface());
} else {
// Include case: since included .js files load source differently we have to manually
// look up the include defs. If there is a usecase for looking up the defs in a non-doc
// setting, a lookup method should be added to the includeDef class.
String name = (String) component.getAttributes().getValue("includeDefName");