This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository nuiton-utils. See http://git.nuiton.org/nuiton-utils.git commit 78ed643d62d182bce4f513759fbe290a97499eb7 Author: Tony CHEMIT <chemit@codelutin.com> Date: Wed Aug 19 13:58:29 2015 +0200 Add Binder#getSourcePropertyType and Binder#getTargetPropertyType methods (fixes #3757) --- src/main/java/org/nuiton/util/beans/Binder.java | 28 +++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/main/java/org/nuiton/util/beans/Binder.java b/src/main/java/org/nuiton/util/beans/Binder.java index f4a630a..befc994 100644 --- a/src/main/java/org/nuiton/util/beans/Binder.java +++ b/src/main/java/org/nuiton/util/beans/Binder.java @@ -335,6 +335,34 @@ public class Binder<I, O> implements Serializable { } /** + * Get the type of a source property. + * + * @param propertyName name of the source property + * @return the type of the source property + * @throws IllegalArgumentException if binder does not define this source property + */ + public Class<?> getSourcePropertyType(String propertyName) { + if (!model.containsSourceProperty(propertyName)) { + throw new IllegalArgumentException("Binder "+this+" does not contains source property: "+propertyName); + } + return model.getSourceReadMethod(propertyName).getReturnType(); + } + + /** + * Get the type of a target property. + * + * @param propertyName name of the target property + * @return the type of the target property + * @throws IllegalArgumentException if binder does not define this target property + */ + public Class<?> getTargetPropertyType(String propertyName) { + if (!model.containsTargetProperty(propertyName)) { + throw new IllegalArgumentException("Binder "+this+" does not contains target property: "+propertyName); + } + return model.getTargetWriteMethod(propertyName).getParameterTypes()[0]; + } + + /** * Copy properties from a source bean to a destination one according to * the model of the binder. * <p/> -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.