io.legaldocml.akn.element.Proprietary 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.Source;
import io.legaldocml.akn.type.AgentRef;
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.SOURCE;
import static io.legaldocml.akn.AknElements.PROPRIETARY;
import static io.legaldocml.akn.element.Attributes.attributeGetterSetter4AgentRef;
import static io.legaldocml.akn.util.XmlWriterHelper.writeSource;
import static io.legaldocml.unsafe.UnsafeHelper.getFieldOffset;
/**
* The element proprietary is a metadata container of any additional metadata property that does not belong to the Akoma
* Ntoso properties. Anything can be placed in this element.
*
*
*
*
*
*
*
*
*
*
*
*
*
* @author Jacques Militello
*/
public final class Proprietary extends AnyOtherType implements Source {
/**
* Memory address.
*/
private static final long ADDRESS_PROPRIETARY = Buffers.address(PROPRIETARY);
private static final ImmutableMap> ATTRIBUTES;
static {
ATTRIBUTES = ImmutableMap.>builder()
.putAll(AnyOtherType.ATTRIBUTES)
.put(SOURCE, attributeGetterSetter4AgentRef(SOURCE, getFieldOffset(Proprietary.class, "source")))
.build();
}
private AgentRef source;
/**
* {@inheritDoc}
*/
public AgentRef getSource() {
return this.source;
}
/**
* {@inheritDoc}
*/
public void setSource(AgentRef source) {
this.source = source;
}
/**
* {@inheritDoc}
*/
@Override
public void write(XmlWriter writer) throws IOException {
writer.writeStart(ADDRESS_PROPRIETARY, 11);
writeSource(writer, this);
super.write(writer);
writer.writeEnd(ADDRESS_PROPRIETARY, 11);
}
/**
* {@inheritDoc}
*/
@Override
public String name() {
return PROPRIETARY;
}
/**
* {@inheritDoc}
*/
@Override
public ImmutableMap> attributes() {
return ATTRIBUTES;
}
}