private List<InterfaceInfo> createChoiceInterface(List<XsdGroup> groupElements, List<XsdElement> directElements, String interfaceName, String className, String groupName, int interfaceIndex, String apiName) {
        List<InterfaceInfo> interfaceInfoList = new ArrayList<>();
        List<String> extendedInterfaces = new ArrayList<>();

        for (XsdGroup groupElement : groupElements) {
            InterfaceInfo interfaceInfo = iterativeCreation(groupElement, className, interfaceIndex + 1, apiName, groupName).get(0);

            interfaceIndex = interfaceInfo.getInterfaceIndex();
            extendedInterfaces.add(interfaceInfo.getInterfaceName());
            interfaceInfoList.add(interfaceInfo);
        }

        Set<String> ambiguousMethods = getAmbiguousMethods(interfaceInfoList);

        if (ambiguousMethods.isEmpty() && directElements.isEmpty()){
            return interfaceInfoList;
        }

        String[] extendedInterfacesArr = listToArray(extendedInterfaces, TEXT_GROUP);

        ClassWriter classWriter = generateClass(interfaceName, JAVA_OBJECT, extendedInterfacesArr, getInterfaceSignature(extendedInterfacesArr, apiName), ACC_PUBLIC + ACC_ABSTRACT + ACC_INTERFACE, apiName);

        String interfaceType = getFullClassTypeName(interfaceName, apiName);

        directElements.forEach(child -> {
            generateMethodsForElement(classWriter, child, interfaceType, apiName);
            createElement(child, apiName);
        });

        ambiguousMethods.forEach(ambiguousMethodName ->
            generateMethodsForElement(classWriter, ambiguousMethodName, interfaceType, apiName, new String[]{"Ljava/lang/Override;"})
        );

        writeClassToFile(interfaceName, classWriter, apiName);

        List<InterfaceInfo> choiceInterface = new ArrayList<>();

        choiceInterface.add(new InterfaceInfo(interfaceName, interfaceIndex, directElements.stream().map(XsdElement::getName).collect(Collectors.toList()), interfaceInfoList));

        return choiceInterface;
    }
private List < InterfaceInfo > createChoiceInterface ( List < XsdGroup > groupElements , List < XsdElement > directElements , String interfaceName , String className , String groupName , int interfaceIndex , String apiName ) { List < InterfaceInfo > interfaceInfoList = new ArrayList < > ( ) ; List < String > extendedInterfaces = new ArrayList < > ( ) ; for ( XsdGroup groupElement : groupElements ) { InterfaceInfo interfaceInfo = iterativeCreation ( groupElement , className , interfaceIndex + 1 , apiName , groupName ) . get ( 0 ) ; interfaceIndex = interfaceInfo . getInterfaceIndex ( ) ; extendedInterfaces . add ( interfaceInfo . getInterfaceName ( ) ) ; interfaceInfoList . add ( interfaceInfo ) ; } Set < String > ambiguousMethods = getAmbiguousMethods ( interfaceInfoList ) ; if ( ambiguousMethods . isEmpty ( ) && directElements . isEmpty ( ) ) { return interfaceInfoList ; } String [ ] extendedInterfacesArr = listToArray ( extendedInterfaces , TEXT_GROUP ) ; ClassWriter classWriter = generateClass ( interfaceName , JAVA_OBJECT , extendedInterfacesArr , getInterfaceSignature ( extendedInterfacesArr , apiName ) , ACC_PUBLIC + ACC_ABSTRACT + ACC_INTERFACE , apiName ) ; String interfaceType = getFullClassTypeName ( interfaceName , apiName ) ; directElements . forEach ( child -> { generateMethodsForElement ( classWriter , child , interfaceType , apiName ) ; createElement ( child , apiName ) ; } ) ; ambiguousMethods . forEach ( ambiguousMethodName -> generateMethodsForElement ( classWriter , ambiguousMethodName , interfaceType , apiName , new String [ ] { "Ljava/lang/Override;" } ) ) ; writeClassToFile ( interfaceName , classWriter , apiName ) ; List < InterfaceInfo > choiceInterface = new ArrayList < > ( ) ; choiceInterface . add ( new InterfaceInfo ( interfaceName , interfaceIndex , directElements . stream ( ) . map ( XsdElement :: getName ) . collect ( Collectors . toList ( ) ) , interfaceInfoList ) ) ; return choiceInterface ; }
Generates an interface based on a {@link XsdChoice} element.
@param groupElements The contained groupElements.
@param directElements The direct elements of the {@link XsdChoice} element.
@param interfaceName The choice interface name.
@param className The name of the class that contains the {@link XsdChoice} element.
@param interfaceIndex The current interface index.
@param apiName The name of the generated fluent interface.
@param groupName The name of the group in which this {@link XsdChoice} element is contained, if any.
@return A {@link List} of {@link InterfaceInfo} objects containing relevant interface information.