boolean (@NotNull Object object) { try { for (Field field : object.getClass().getDeclaredFields()) { field.setAccessible(true); final PropertyName annotation = field.getAnnotation(PropertyName.class); if (annotation != null) { final Class<?> type = field.getType(); String defaultValue = annotation.defaultValue(); if (PropertyName.NOT_SET.equals(defaultValue)) { if (type.equals(boolean.class)) { defaultValue = String.valueOf(field.getBoolean(object)); } else if (type.equals(long.class)) { defaultValue = String.valueOf(field.getLong(object)); } else if (type.equals(int.class)) { defaultValue = String.valueOf(field.getInt(object)); } else if (type.equals(short.class)) { defaultValue = String.valueOf(field.getShort(object)); } else if (type.equals(byte.class)) { defaultValue = String.valueOf(field.getByte(object)); } else if (type.equals(double.class)) { defaultValue = String.valueOf(field.getDouble(object)); } else if (type.equals(float.class)) { defaultValue = String.valueOf(field.getFloat(object)); } else if (type.equals(String.class)) { defaultValue = String.valueOf(field.get(object)); } } final String stringValue = getValue(annotation.value(), defaultValue); Object value = null; if (type.equals(boolean.class)) { value = Boolean.valueOf(stringValue); } else if (type.equals(long.class)) { value = Long.parseLong(stringValue); } else if (type.equals(int.class)) { value = Integer.parseInt(stringValue); } else if (type.equals(short.class)) { value = Short.parseShort(stringValue); } else if (type.equals(byte.class)) { value = Byte.parseByte(stringValue); } else if (type.equals(double.class)) { value = Double.parseDouble(stringValue); } else if (type.equals(float.class)) { value = Float.parseFloat(stringValue); } else if (type.equals(String.class)) { value = stringValue; } if (value != null) { field.set(object, value); } } } return true; } catch (IllegalAccessException e) { return false; } }