public static ComponentBuilder<?> createComponentBuilder(
      ComponentDescriptor descriptor, Uniqueness ownerUniqueness, BeneratorContext context) {
    LOGGER.debug("createComponentBuilder({})", descriptor.getName());

    ComponentBuilder<?> result = null;
    if (descriptor instanceof ArrayElementDescriptor)
      result = createPartBuilder(descriptor, ownerUniqueness, context);
    else if (descriptor instanceof PartDescriptor) {
      TypeDescriptor type = descriptor.getTypeDescriptor();
      if (type instanceof AlternativeGroupDescriptor)
        result =
            createAlternativeGroupBuilder(
                (AlternativeGroupDescriptor) type, ownerUniqueness, context);
      else result = createPartBuilder(descriptor, ownerUniqueness, context);
    } else if (descriptor instanceof ReferenceDescriptor)
      result = createReferenceBuilder((ReferenceDescriptor) descriptor, context);
    else if (descriptor instanceof IdDescriptor)
      result = createIdBuilder((IdDescriptor) descriptor, ownerUniqueness, context);
    else throw new ConfigurationError("Not a supported element: " + descriptor.getClass());
    result = wrapWithCondition(descriptor, result);
    return result;
  }