io.legaldocml.akn.element.Amendments 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.util.AknList;
import io.legaldocml.akn.util.XmlReaderHelper;
import io.legaldocml.io.XmlReader;
import io.legaldocml.io.XmlWriter;
import java.io.IOException;
import java.util.function.Supplier;
import static io.legaldocml.akn.AknElements.EFFICACY_MOD;
import static io.legaldocml.akn.AknElements.FORCE_MOD;
import static io.legaldocml.akn.AknElements.LEGAL_SYSTEM_MOD;
import static io.legaldocml.akn.AknElements.MEANING_MOD;
import static io.legaldocml.akn.AknElements.SCOPE_MOD;
import static io.legaldocml.akn.AknElements.TEXTUAL_MOD;
/**
* The complex type Amendments is a list of all the amendment elements that can be used on a document analysis.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
* @author Jacques Militello
*/
public abstract class Amendments implements AknObject {
private static final ImmutableMap> ELEMS;
static {
ELEMS = ImmutableMap.>builder()
.put(TEXTUAL_MOD, TextualMod::new)
.put(MEANING_MOD, MeaningMod::new)
.put(SCOPE_MOD, ScopeMod::new)
.put(FORCE_MOD, ForceMod::new)
.put(EFFICACY_MOD, EfficacyMod::new)
.put(LEGAL_SYSTEM_MOD, LegalSystemMod::new)
.build();
}
// Mandatory (min 1).
private final AknList elements = new AknList<>(new AmendmentsElement[4]);
/**
* {@inheritDoc}
*/
@Override
public void write(XmlWriter writer) throws IOException {
this.elements.write(writer);
}
/**
* {@inheritDoc}
*/
@Override
public void read(XmlReader reader) {
XmlReaderHelper.read(reader, elements, ELEMS);
}
}