if (object != null && !schema.getType().isAssignableFrom(object.getClass())) { throw new RuntimeException(String.format("schema type '%s' does not match given object type '%s'", schema.getType(), object.getClass())); }
    public static MetaObject createObject(Object object, Schema schema) {        Schema usedSchema = schema;                if (usedSchema == null && !(object instanceof Collection)) {            usedSchema = SchemaFactory.create(object);        }                if (usedSchema == null && object instanceof Collection) {            Collection collection = (Collection) object;                        if (! collection.isEmpty()) {                usedSchema = SchemaFactory.create(collection.iterator().next());                }        }                return currentFactory.createMetaObject(object, usedSchema);    }