public void setValue(Object self, Object value) {
        if (isBoolean && value instanceof Number) {
            value = ((Number) value).longValue() > 0 ? Boolean.TRUE : Boolean.FALSE;
        }

        try {
            if (writeMethod != null) {
                writeMethod.invoke(self, new Object[]{value});
            } else if (field != null) {
                field.set(self, value);
            } else {
                throw new RuntimeException("Field or field setter missing: " + name);
            }
        } catch (Exception ex) {
            throw new RuntimeException("Cannot set value of field: " + name, ex);
        }
    }