protected void checkValidObject()

in openwire-core/src/main/java/org/apache/activemq/openwire/commands/OpenWireMessage.java [372:388]


    protected void checkValidObject(Object value) throws IOException {

        // TODO - We can probably remove these nested enabled check, the provider should
        //        do this since we are just a codec.
        boolean valid = value instanceof Boolean || value instanceof Byte || value instanceof Short || value instanceof Integer || value instanceof Long;
        valid = valid || value instanceof Float || value instanceof Double || value instanceof Character || value instanceof String || value == null;

        if (!valid) {
            if (isNestedMapAndListAllowed()) {
                if (!(value instanceof Map || value instanceof List)) {
                    throw new IllegalArgumentException("Only objectified primitive objects, String, Map and List types are allowed but was: " + value + " type: " + value.getClass());
                }
            } else {
                throw new IllegalArgumentException("Only objectified primitive objects and String types are allowed but was: " + value + " type: " + value.getClass());
            }
        }
    }