FileDocCategorySizeDatePackage
HTMLAttribute.javaAPI DocGlassfish v2 API4091Fri May 04 22:34:48 BST 2007com.sun.enterprise.diagnostics.report.html

HTMLAttribute

public class HTMLAttribute extends Object implements Attribute, Text
Provide a basic implementation of an attribute.

Fields Summary
private String
name
The name of this attribute.
private String
value
The value of this attribute.
private static final String
DOUBLE_QUOTES
private static final char
EQUALS
Constructors Summary
public HTMLAttribute(String name, String value)
Create a new attribute.

param
name The name of the attribute.
param
value The value of the attribute.

          	      	         
         
        setName(name);
        setValue(value);
    
Methods Summary
public java.lang.StringgetName()

        return name;
    
public java.lang.StringgetValue()

        return value;
    
public voidsetName(java.lang.String name)

        if (name == null) {
            throw new NullPointerException("Attribute name is null");
        }
        this.name = name;
    
public voidsetValue(java.lang.String value)

        if (value == null) {
            throw new NullPointerException("Attribute value is null.");
        }
        this.value = value;
    
public java.lang.StringtoString()

see
java.lang.Object#toString()

        String nameStr = Escape.getInstance().encodeEntities(name, " \t\r\n");
        String valueStr = Escape.getInstance().encodeEntities(value, "");
        StringBuffer buf = new StringBuffer();
        buf.append(nameStr)
        	.append(EQUALS+DOUBLE_QUOTES)
        	.append(valueStr)
        	.append(DOUBLE_QUOTES);
        return buf.toString();
    
public voidwrite(java.io.Writer output)

        output.append(toString());
        output.flush();
    
public voidwrite(java.io.File file)

        FileWriter fw = new FileWriter(file);
        write(fw);
        fw.close();