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

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

The newest version!
package io.legaldocml.akn.element;

import com.google.common.collect.ImmutableMap;
import io.legaldocml.akn.AknObject;
import io.legaldocml.akn.attribute.ForceModType;
import io.legaldocml.akn.type.ForceMods;
import io.legaldocml.io.AttributeGetterSetter;
import io.legaldocml.io.XmlWriter;
import io.legaldocml.io.impl.Buffers;

import java.io.IOException;

import static io.legaldocml.akn.AknAttributes.TYPE;
import static io.legaldocml.akn.AknElements.FORCE_MOD;
import static io.legaldocml.akn.element.Attributes.ADDRESS_TYPE;
import static io.legaldocml.akn.element.Attributes.attributeGetterSetter4Enum;
import static io.legaldocml.unsafe.UnsafeHelper.getFieldOffset;
import static io.legaldocml.unsafe.UnsafeString.getChars;

/**
 * The element forceMod is a metadata element specifying an (active or passive) modification in force for the document.
 * 

*

 *   
 * 	   
 * 	     
 * 		   
 * 		     
 * 		 
 * 	     
 * 	   
 *   
 * 
* * @author Jacques Militello */ public final class ForceMod extends ModificationType implements ForceModType, AmendmentsElement { /** * Memory address. */ private static final long ADDRESS_FORCE_MOD = Buffers.address(FORCE_MOD); protected static final ImmutableMap> ATTRIBUTES; static { ATTRIBUTES = ImmutableMap.>builder() .putAll(ModificationType.ATTRIBUTES) .put(TYPE, attributeGetterSetter4Enum(TYPE, getFieldOffset(ForceMod.class, "type"), ForceMods.class)) .build(); } private ForceMods type; /** * {@inheritDoc} */ @Override public ForceMods getType() { return this.type; } /** * {@inheritDoc} */ @Override public void setType(ForceMods type) { this.type = type; } /** * {@inheritDoc} */ @Override public void write(XmlWriter writer) throws IOException { writer.writeStart(ADDRESS_FORCE_MOD, 8); if (this.type != null) { writer.writeAttribute(ADDRESS_TYPE, 4, getChars(this.type.name())); } super.write(writer); writer.writeEnd(ADDRESS_FORCE_MOD, 8); } /** * {@inheritDoc} */ @Override public String name() { return FORCE_MOD; } /** * {@inheritDoc} */ @Override public ImmutableMap> attributes() { return ATTRIBUTES; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy