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

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

package io.legaldocml.akn.element;

import com.google.common.collect.ImmutableMap;
import io.legaldocml.akn.AknObject;
import io.legaldocml.akn.attribute.Source;
import io.legaldocml.akn.type.AgentRef;
import io.legaldocml.akn.util.AknList;
import io.legaldocml.akn.util.XmlReaderHelper;
import io.legaldocml.io.CharArray;
import io.legaldocml.io.XmlReader;
import io.legaldocml.io.XmlWriter;

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

import static io.legaldocml.akn.element.Attributes.biConsumerAgentRef;
import static io.legaldocml.akn.element.Groups.TLCs;
import static io.legaldocml.akn.element.Groups.convertSuper;
import static io.legaldocml.akn.element.Groups.docRefs;
import static io.legaldocml.akn.util.XmlWriterHelper.writeSource;
import static io.legaldocml.unsafe.UnsafeHelper.getFieldOffset;

/**
 * The complex type refItems is a list of types of references used in the references section.
 *
 * 
 *   <xsd:complexType name="refItems">
 * 	   <xsd:choice minOccurs="1" maxOccurs="unbounded">
 *       <xsd:group ref="docRefs"/>
 *       <xsd:group ref="TLCs"/>
 *     <xsd:choice>
 *     <xsd:attributeGroup ref="source"/>
 *   <xsd:complexType>
 * 
* * @author Jacques Militello */ public abstract class RefItems implements Source { private static final ImmutableMap> ATTRIBUTES; private static final ImmutableMap> ELEMS; static { ATTRIBUTES = ImmutableMap.>builder() .put(Source.ATTRIBUTE, biConsumerAgentRef(getFieldOffset(RefItems.class, "source"))) .build(); ELEMS = ImmutableMap.>builder() .putAll(convertSuper(docRefs())) .putAll(convertSuper(TLCs())) .build(); } // Mandatory (min 1) private final AknList refItems = new AknList(new RefItem[6]); // Mandatory private AgentRef source; /** * {@inheritDoc} */ public AgentRef getSource() { return this.source; } /** * {@inheritDoc} */ public void setSource(AgentRef source) { this.source = source; } /** * {@inheritDoc} */ @Override public void write(XmlWriter writer) throws IOException { writeSource(writer, this); this.refItems.write(writer); } /** * {@inheritDoc} */ @Override public void read(XmlReader reader) { Attributes.read(reader, this); XmlReaderHelper.read(reader, this.refItems, ELEMS); } /** * {@inheritDoc} */ @Override public ImmutableMap> attributes() { return ATTRIBUTES; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy