package com.sun.deploy.xml;
import java.util.ArrayList;
import java.net.URL;
public class XMLAttributeBuilder {
private XMLAttribute _root;
private XMLAttribute _next;
public XMLAttributeBuilder() {
_root = null;
}
public void add(XMLAttribute attr) {
if (attr != null) {
if (_next == null) {
_root = _next = attr;
attr.setNext(null);
} else {
_next.setNext(attr);
_next = attr;
attr.setNext(null);
}
}
}
public void add(String name, String value) {
if (value != null && value.length() > 0) {
add(new XMLAttribute(name, value));
}
}
public void add(String name, URL value) {
if (value != null) {
add(new XMLAttribute(name, value.toString()));
}
}
public void add(String name, long value) {
if (value != 0) {
add(new XMLAttribute(name, new Long(value).toString()));
}
}
public void add(String name, boolean value) {
add(new XMLAttribute(name, (value) ? "true" : "false" ));
}
public XMLAttribute getAttributeList() { return _root; }
}