
org.jwat.tools.tasks.containermd.ContainerMDElement Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jwat-tools Show documentation
Show all versions of jwat-tools Show documentation
JWAT-Tools uses the available JWAT libraries to make high level tasks available either from command-line or programmatically.
Common tasks include: Test, Compress, Decompress, CDX, Arc2Warc.
More specialised tasks include: Changed, ContainerMD, Delete, Extract, Interval, PathIndex, Unpack, Headers2CDX.
package org.jwat.tools.tasks.containermd;
import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;
/**
* ContainerElement
*
*/
public final class ContainerMDElement {
private SortedMap attributes = new TreeMap();
private final String elementName;
private final String value;
/**
* Creates a new ContainerElement
*/
public ContainerMDElement() {
this(null, null);
}
public ContainerMDElement(String name) {
this(name, null);
}
public ContainerMDElement(String name, String value) {
this.elementName = name;
this.value = value;
}
/**
* Gets attributes
*
* @return Map
*/
public Map getAttributes() {
return this.attributes;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
toXml(sb);
return sb.toString();
}
public void toXml(StringBuilder sb) {
toXml(sb, null, false);
}
/**
* Convert to XML element
*
* @param sb
*/
public void toXml(StringBuilder sb, String name, boolean bAttrNameToValue) {
ContainerMDUtils.makeElement(sb, (name == null)? this.elementName:name, this.value,
this.attributes, bAttrNameToValue);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy