/** * Reads @Id value from provided source object. * * @param source object to read @Id value from * @return {@link String} id or <code>null</code> * @throws IllegalAccessException */ private String getIdValue(Object source) throws IllegalAccessException { Field idField = configuration.getIdField(source.getClass()); ResourceIdHandler handler = configuration.getIdHandler(source.getClass()); return handler.asString(idField.get(source)); }
/** * Sets an id attribute value to a target object. * @param target target POJO * @param idValue id node * @throws IllegalAccessException thrown in case target field is not accessible */ private void setIdValue(Object target, JsonNode idValue) throws IllegalAccessException { Field idField = configuration.getIdField(target.getClass()); ResourceIdHandler idHandler = configuration.getIdHandler(target.getClass()); if (idValue != null) { idField.set(target, idHandler.fromString(idValue.asText())); } }
/** * Reads @Id value from provided source object. * * @param source object to read @Id value from * @return {@link String} id or <code>null</code> * @throws IllegalAccessException */ private String getIdValue(Object source) throws IllegalAccessException { Field idField = configuration.getIdField(source.getClass()); ResourceIdHandler handler = configuration.getIdHandler(source.getClass()); return handler.asString(idField.get(source)); }
/** * Sets an id attribute value to a target object. * @param target target POJO * @param idValue id node * @throws IllegalAccessException thrown in case target field is not accessible */ private void setIdValue(Object target, JsonNode idValue) throws IllegalAccessException { Field idField = configuration.getIdField(target.getClass()); ResourceIdHandler idHandler = configuration.getIdHandler(target.getClass()); if (idValue != null) { idField.set(target, idHandler.fromString(idValue.asText())); } }