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.AknAttributes;
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.akn.visitor.AknVisitor;
import io.legaldocml.io.CharArray;
import io.legaldocml.io.Externalizable;
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.
 *
 * 
 *   
 * 	   
 *       
 *       
 *     
 *     
 *   
 * 
* * @author Jacques Militello */ public abstract class RefItems implements Source { private static final ImmutableMap> ATTRIBUTES; private static final ImmutableMap> ELEMS; static { ATTRIBUTES = ImmutableMap.>builder() .put(AknAttributes.SOURCE, 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; } public final AknList getRefItems() { return this.refItems; } public final void add(RefItem item) { this.refItems.add(item); } /** * {@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; } /** * {@inheritDoc} */ @Override public void accept(AknVisitor visitor) { this.refItems.accept(visitor); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy