Author: tchemit Date: 2010-05-28 12:13:06 +0200 (Fri, 28 May 2010) New Revision: 1870 Url: http://nuiton.org/repositories/revision/nuiton-utils/1870 Log: fix bug (too much code...) Modified: trunk/src/main/java/org/nuiton/util/beans/Binder.java Modified: trunk/src/main/java/org/nuiton/util/beans/Binder.java =================================================================== --- trunk/src/main/java/org/nuiton/util/beans/Binder.java 2010-05-25 13:41:02 UTC (rev 1869) +++ trunk/src/main/java/org/nuiton/util/beans/Binder.java 2010-05-28 10:13:06 UTC (rev 1870) @@ -209,7 +209,7 @@ */ public void copy(I source, O target, String... propertyNames) { copy(source, target, false, propertyNames); - } + } /** * Copy properties from a source bean to a destination one according to @@ -236,24 +236,24 @@ * <b>Note:</b> If {@code from} object is null, then {@code null} values * will be set to mapped properties into {@code dst}. * - * @param source the bean to read - * @param target the bean to write + * @param source the bean to read + * @param target the bean to write * @param excludeProperties true to exclude following {@code propertyNames} - * @param propertyNames optional subset of properties to copy (if none is - * specifed, will use all the properties defined in - * binder) + * @param propertyNames optional subset of properties to copy (if none is + * specifed, will use all the properties defined in + * binder) * @throws NullPointerException if target parameter is {@code null} */ protected void copy(I source, O target, boolean excludeProperties, - String... propertyNames) + String... propertyNames) throws NullPointerException { if (target == null) { throw new NullPointerException("parameter 'target' can no be null"); } propertyNames = excludeProperties ? - getAllPropertiesExclude(propertyNames) : - getProperties(propertyNames); + getAllPropertiesExclude(propertyNames) : + getProperties(propertyNames); for (String sourceProperty : propertyNames) { @@ -288,10 +288,6 @@ // specific collection strategy is set, must use it read = getCollectionValue(sourceProperty, read); } - if (model.containsCollectionProperty(sourceProperty)) { - // specific collection strategy is set, must use it - read = getCollectionValue(sourceProperty, read); - } model.getTargetWriteMethod(targetProperty).invoke(target, read); } catch (IllegalAccessException e) { throw new RuntimeException(e); @@ -350,10 +346,10 @@ } /** - * Obtains all properties from binder's model except those {@code + * Obtains all properties from binder's model except those {@code * propertyNameExcludes}. Unknown properties will be ignored. * - * @param propertyNameExcludes name of properties to exclude + * @param propertyNameExcludes name of properties to exclude * @return the array of property names without those in argument */ protected String[] getAllPropertiesExclude(String... propertyNameExcludes) { @@ -361,7 +357,7 @@ List<String> results = new ArrayList<String>(); for (String propertyName : model.getSourceDescriptors()) { if (!excludes.contains(propertyName)) { - results.add(propertyName); + results.add(propertyName); } } return results.toArray(new String[results.size()]);
participants (1)
-
tchemit@users.nuiton.org