This implementation follows section 3.5.4 of the Java Message Service specification (Version 1.1 April 12, 2002).
TODO - should have typed property getters and do conversions herein @author Tim Fox @author Clebert Suconic
858687888990919293949596979899100101
textValue2.setValue("value2"); textValue3 = new TextValue(); textValue3.setValue("value3"); booleanValue1 = new BooleanValue(); booleanValue1.setValue(false); booleanValue2 = new BooleanValue(); booleanValue2.setValue(true); booleanValue3 = new BooleanValue(); booleanValue3.setValue(false); numberValue1 = new NumberValue(); numberValue1.setValue("1");
132133134135136137138139140141
} @Test public void testToString_null() { assertEquals("", Pql.toString(new TextValue())); assertEquals("", Pql.toString(new BooleanValue())); assertEquals("", Pql.toString(new NumberValue())); assertEquals("", Pql.toString(new DateTimeValue())); assertEquals("", Pql.toString(new DateValue())); }
818283848586878889909192
return (Value) value; } else if (value == null) { return new TextValue(); } else { if (value instanceof Boolean) { BooleanValue booleanValue = new BooleanValue(); booleanValue.setValue((Boolean) value); return booleanValue; } else if (value instanceof Double || value instanceof Long || value instanceof Integer) { NumberValue numberValue = new NumberValue(); numberValue.setValue(value.toString()); return numberValue;
8182838485868788899091929394959697
125126127128129130131132133
} @Test public void testToString_null() { assertEquals("", Pql.toString(new TextValue())); assertEquals("", Pql.toString(new BooleanValue())); assertEquals("", Pql.toString(new NumberValue())); assertEquals("", Pql.toString(new DateTimeValue())); }