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

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

package io.legaldocml.akn.element;

import com.google.common.collect.ImmutableMap;
import io.legaldocml.akn.AknObject;
import io.legaldocml.akn.attribute.Name;
import io.legaldocml.akn.group.HierElements;
import io.legaldocml.io.impl.Buffers;
import io.legaldocml.io.CharArray;
import io.legaldocml.io.XmlWriter;

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

import static io.legaldocml.akn.element.Attributes.biConsumerString;
import static io.legaldocml.akn.util.XmlWriterHelper.writeName;
import static io.legaldocml.unsafe.UnsafeHelper.getFieldOffset;

/**
 * The element hcontainer is a generic element for a hierarchical container. It can be placed in a hierarchy instead of
 * any of the other hierarchical containers. The attribute name is required and gives a name to the element.
 *
 * 
 *   <xsd:element name="hcontainer">
 * 	   <xsd:complexType>
 * 	     <xsd:complexContent>
 * 		   <xsd:extension base="hierarchy">
 * 		     <xsd:attributeGroup ref="name"/>
 * 		   <xsd:extension>
 * 	     <xsd:complexContent>
 * 	   <xsd:complexType>
 *   <xsd:element>
 * 
* * @author Jacques Militello */ public final class Hcontainer extends Hierarchy implements Name, HierElements { /** * XML tag element name. */ public static final String ELEMENT = "hcontainer"; /** * Memory address. */ private static final long ADDRESS = Buffers.address(ELEMENT); private static final ImmutableMap> ATTRIBUTES; static { ATTRIBUTES = ImmutableMap.>builder() .putAll(Hierarchy.ATTRIBUTES) .put("name", biConsumerString(getFieldOffset(Hcontainer.class, "name"))) .build(); } /** * The attribute name. */ private String name; /** * {@inheritDoc} */ @Override public String getName() { return this.name; } /** * {@inheritDoc} */ @Override public void setName(String name) { this.name = name; } /** * {@inheritDoc} */ @Override public void write(XmlWriter writer) throws IOException { writer.writeStart(ADDRESS, 10); writeName(writer, this); super.write(writer); writer.writeEnd(ADDRESS, 10); } /** * {@inheritDoc} */ @Override public String name() { return ELEMENT; } /** * {@inheritDoc} */ @Override public ImmutableMap> attributes() { return ATTRIBUTES; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy