All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.legaldocml.akn.element.Preambleopt Maven / Gradle / Ivy

package io.legaldocml.akn.element;

import com.google.common.collect.ImmutableMap;
import io.legaldocml.akn.util.AknList;
import io.legaldocml.akn.util.XmlReaderHelper;
import io.legaldocml.akn.visitor.AknVisitor;
import io.legaldocml.io.XmlReader;
import io.legaldocml.io.XmlWriter;

import java.io.IOException;
import java.util.function.Supplier;

import static io.legaldocml.akn.element.Groups.blockElements;
import static io.legaldocml.akn.element.Groups.convertSuper;
import static io.legaldocml.akn.element.Groups.preambleContainers;

/**
 * The complex type preambleopt defines the content model and attributes used by preambles. Here the eId attribute is
 * optional.
 *
 * 
 *   <xsd:complexType name="preambleopt">
 * 	   <xsd:choice minOccurs="1" maxOccurs="unbounded">
 * 	     <xsd:group ref="blockElements"/>
 * 		 <xsd:group ref="preambleContainers"/>
 * 	   <xsd:choice>
 * 	   <xsd:attributeGroup ref="coreopt"/>
 *   <xsd:complexType>
 * 
 *
 * @author Jacques Militello
 */
public abstract class Preambleopt extends CoreOptImpl {

    private static final ImmutableMap> ELEMS;

    static {
        ELEMS = ImmutableMap.>builder()
                .putAll(convertSuper(blockElements()))
                .putAll(convertSuper(preambleContainers()))
                .build();
    }

    private final AknList elements = new AknList<>(new PreambleoptElement[4]);

    /**
     * {@inheritDoc}
     */
    @Override
    public void read(XmlReader reader) {
        super.read(reader);
        XmlReaderHelper.read(reader, elements, ELEMS);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void write(XmlWriter writer) throws IOException {
        super.write(writer);
        this.elements.write(writer);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void accept(AknVisitor visitor) {
       this.elements.accept(visitor);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy