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

org.jwat.tools.tasks.containermd.ContainerMDElement Maven / Gradle / Ivy

Go to download

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.

There is a newer version: 0.7.1
Show newest version
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