in openwire-core/src/main/java/org/apache/activemq/openwire/utils/OpenWireMarshallingSupport.java [126:160]
public static void marshalPrimitive(DataOutput out, Object value) throws IOException {
if (value == null) {
marshalNull(out);
} else if (value.getClass() == Boolean.class) {
marshalBoolean(out, ((Boolean) value).booleanValue());
} else if (value.getClass() == Byte.class) {
marshalByte(out, ((Byte) value).byteValue());
} else if (value.getClass() == Character.class) {
marshalChar(out, ((Character) value).charValue());
} else if (value.getClass() == Short.class) {
marshalShort(out, ((Short) value).shortValue());
} else if (value.getClass() == Integer.class) {
marshalInt(out, ((Integer) value).intValue());
} else if (value.getClass() == Long.class) {
marshalLong(out, ((Long) value).longValue());
} else if (value.getClass() == Float.class) {
marshalFloat(out, ((Float) value).floatValue());
} else if (value.getClass() == Double.class) {
marshalDouble(out, ((Double) value).doubleValue());
} else if (value.getClass() == byte[].class) {
marshalByteArray(out, (byte[]) value);
} else if (value.getClass() == String.class) {
marshalString(out, (String) value);
} else if (value.getClass() == UTF8Buffer.class) {
marshalString(out, value.toString());
} else if (value instanceof Map) {
out.writeByte(MAP_TYPE);
marshalPrimitiveMap((Map<String, Object>) value, out);
} else if (value instanceof List) {
out.writeByte(LIST_TYPE);
marshalPrimitiveList((List<Object>) value, out);
} else {
throw new IOException("Object is not a primitive: " + value);
}
}