io.legaldocml.akn.element.NoteRef 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.LinkReq;
import io.legaldocml.akn.attribute.Notes;
import io.legaldocml.akn.group.ANmarker;
import io.legaldocml.akn.type.EidRef;
import io.legaldocml.akn.type.PlacementType;
import io.legaldocml.akn.type.Uri;
import io.legaldocml.akn.visitor.AknVisitor;
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.HREF;
import static io.legaldocml.akn.AknAttributes.MARKER;
import static io.legaldocml.akn.AknAttributes.PLACEMENT;
import static io.legaldocml.akn.AknAttributes.PLACEMENT_BASE;
import static io.legaldocml.akn.AknElements.NOTE_REF;
import static io.legaldocml.akn.element.Attributes.attributeGetterSetter4EidRef;
import static io.legaldocml.akn.element.Attributes.attributeGetterSetter4Enum;
import static io.legaldocml.akn.element.Attributes.attributeGetterSetter4String;
import static io.legaldocml.akn.util.XmlWriterHelper.writeLinkReq;
import static io.legaldocml.akn.util.XmlWriterHelper.writeNotes;
import static io.legaldocml.unsafe.UnsafeHelper.getFieldOffset;
/**
* the element noteRef is a reference to a editorial note placed in the notes metadata section.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
* @author Jacques Militello
*/
public final class NoteRef extends MarkerOpt implements LinkReq, Notes, ANmarker {
/**
* Memory address.
*/
private static final long ADDRESS_NOTE_REF = Buffers.address(NOTE_REF);
private static final ImmutableMap> ATTRIBUTES;
static {
ATTRIBUTES = ImmutableMap.>builder()
.putAll(MarkerOpt.ATTRIBUTES)
.put(HREF, Attributes.attributeGetterSetter4Uri(HREF, getFieldOffset(NoteRef.class, "href")))
.put(MARKER, attributeGetterSetter4String(MARKER, getFieldOffset(NoteRef.class, "marker")))
.put(PLACEMENT_BASE, attributeGetterSetter4EidRef(PLACEMENT_BASE, getFieldOffset(NoteRef.class, "placementBase")))
.put(PLACEMENT, attributeGetterSetter4Enum(PLACEMENT, getFieldOffset(NoteRef.class, "placementType"), PlacementType.class))
.build();
}
private Uri href;
private String marker;
private PlacementType placementType;
private EidRef placementBase;
/**
* {@inheritDoc}
*/
@Override
public String getMarker() {
return this.marker;
}
/**
* {@inheritDoc}
*/
@Override
public void setMarker(String marker) {
this.marker = marker;
}
/**
* {@inheritDoc}
*/
@Override
public PlacementType getPlacement() {
return this.placementType;
}
/**
* {@inheritDoc}
*/
@Override
public void setPlacement(PlacementType placement) {
this.placementType = placement;
}
/**
* {@inheritDoc}
*/
@Override
public EidRef getPlacementBase() {
return this.placementBase;
}
/**
* {@inheritDoc}
*/
@Override
public void setPlacementBase(EidRef placementBase) {
this.placementBase = placementBase;
}
/**
* {@inheritDoc}
*/
@Override
public Uri getHref() {
return this.href;
}
/**
* {@inheritDoc}
*/
@Override
public void setHref(Uri href) {
this.href = href;
}
/**
* {@inheritDoc}
*/
@Override
public void write(XmlWriter writer) throws IOException {
writer.writeStart(ADDRESS_NOTE_REF, 7);
writeLinkReq(writer, this);
writeNotes(writer, this);
super.write(writer);
writer.writeEnd(ADDRESS_NOTE_REF, 7);
}
/**
* {@inheritDoc}
*/
@Override
public String name() {
return NOTE_REF;
}
/**
* {@inheritDoc}
*/
@Override
public ImmutableMap> attributes() {
return ATTRIBUTES;
}
/**
* {@inheritDoc}
*/
@Override
public void accept(AknVisitor visitor) {
visitor.visit(this);
}
}