public ComponentDefRefHandler(
     RootTagHandler<P> parentHandler, XMLStreamReader xmlReader, Source<?> source) {
   super(parentHandler, xmlReader, source);
   builder.setDescriptor(DefDescriptorImpl.getInstance(getTagName(), ComponentDef.class));
   builder.setLocation(getLocation());
   body = new ArrayList<>();
 }
  @SuppressWarnings("rawtypes")
  @Override
  protected void readSystemAttributes() throws QuickFixException {
    super.readSystemAttributes();
    builder.setLocalId(getSystemAttributeValue("id"));
    String load = getSystemAttributeValue("load");
    if (!AuraTextUtil.isNullEmptyOrWhitespace(load)) {
      Load loadVal;
      try {
        loadVal = Load.valueOf(load.toUpperCase());
      } catch (IllegalArgumentException e) {
        throw new AuraRuntimeException(
            String.format("Invalid value '%s' specified for 'aura:load' attribute", load),
            getLocation());
      }
      builder.setLoad(loadVal);
      if (loadVal == Load.LAZY || loadVal == Load.EXCLUSIVE) {
        ((BaseComponentDefHandler) getParentHandler()).setRender("client");
      }
    }

    String flavor = getSystemAttributeValue("flavor");
    if (!AuraTextUtil.isNullEmptyOrWhitespace(flavor)) {
      builder.setFlavor(flavor);
    }
  }
 /**
  * this one is only used by {@link HTMLComponentDefRefHandler}, which passes in the descriptor,
  * the one above can't use it cause of java stupidness
  */
 protected ComponentDefRefHandler(
     RootTagHandler<P> parentHandler,
     DefDescriptor<ComponentDef> descriptor,
     XMLStreamReader xmlReader,
     Source<?> source) {
   super(parentHandler, xmlReader, source);
   builder.setDescriptor(descriptor);
   builder.setLocation(getLocation());
   body = new ArrayList<>();
 }
 @Override
 protected void readAttributes() throws QuickFixException {
   for (Map.Entry<DefDescriptor<AttributeDef>, AttributeDefRef> entry :
       getAttributes().entrySet()) {
     builder.setAttribute(entry.getKey(), entry.getValue());
   }
 }
  /** Expects either Set tags or ComponentDefRefs */
  @Override
  protected void handleChildTag() throws XMLStreamException, QuickFixException {

    String tag = getTagName();
    if (AttributeDefRefHandler.TAG.equalsIgnoreCase(tag)) {
      AttributeDefRefImpl attributeDefRef =
          new AttributeDefRefHandler<>(getParentHandler(), xmlReader, source).getElement();
      builder.setAttribute(attributeDefRef.getDescriptor(), attributeDefRef);
    } else {
      ComponentDefRef cdr = getDefRefHandler(getParentHandler()).getElement();
      if (cdr.isFlavorable() || cdr.hasFlavorableChild()) {
        builder.setHasFlavorableChild(true);
      }
      body.add(cdr);
    }
  }
  @Override
  protected ComponentDefRef createDefinition() {
    if (!body.isEmpty()) {
      setBody(body);
    }

    // hacky. if there is an interface, grab that descriptor too
    DefDescriptor<InterfaceDef> id =
        DefDescriptorImpl.getInstance(
            builder.getDescriptor().getQualifiedName(), InterfaceDef.class);
    if (id.exists()) {
      builder.setIntfDescriptor(id);
    }

    return builder.build();
  }
 protected void setBody(List<ComponentDefRef> body) {
   builder.setAttribute(AttributeDefRefImpl.BODY_ATTRIBUTE_NAME, body);
 }