package com.bradmcevoy.http.values;

import com.bradmcevoy.http.XmlWriter;
import java.util.Map;

public class BooleanValueWriter implements ValueWriter {

    public void writeValue( XmlWriter writer, String nsUri, String prefix, String localName, Object val, String href, Map<String, String> nsPrefixes ) {
        Boolean b = (Boolean) val;
        writer.writeProperty( prefix, localName, b.toString().toUpperCase() );
    }

    public boolean supports( String nsUri, String localName, Class c ) {
        return c.equals( Boolean.class );
    }

    public Object parse( String namespaceURI, String localPart, String value ) {
        if( value == null ) return false;
        value = value.toLowerCase();
        return value.equals( "t") || value.equals( "true");
    }
}

@@ -536,16 +536,43 @@
 .class )
+ %7C%7C c.equals(boolean.class)
 ;%0A    %7D%0A

make Boolean propertys convert correctly for Boolean and boolean types