You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mb...@apache.org on 2012/03/15 23:07:14 UTC
svn commit: r1301235 -
/commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/NamedEntityCollectionReflector.java
Author: mbenson
Date: Thu Mar 15 22:07:14 2012
New Revision: 1301235
URL: http://svn.apache.org/viewvc?rev=1301235&view=rev
Log:
java 5isms; use of lang3 ArrayUtils
Modified:
commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/NamedEntityCollectionReflector.java
Modified: commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/NamedEntityCollectionReflector.java
URL: http://svn.apache.org/viewvc/commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/NamedEntityCollectionReflector.java?rev=1301235&r1=1301234&r2=1301235&view=diff
==============================================================================
--- commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/NamedEntityCollectionReflector.java (original)
+++ commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/NamedEntityCollectionReflector.java Thu Mar 15 22:07:14 2012
@@ -16,14 +16,12 @@
*/
package org.apache.commons.flatfile.morph;
-import java.util.Arrays;
-import java.util.HashSet;
-
import net.sf.morph.reflect.BeanReflector;
import net.sf.morph.util.ContainerUtils;
import org.apache.commons.flatfile.Entity;
import org.apache.commons.flatfile.NamedEntityCollection;
+import org.apache.commons.lang3.ArrayUtils;
/**
* NamedEntityCollection Reflector.
@@ -36,6 +34,7 @@ public class NamedEntityCollectionReflec
/**
* {@inheritDoc}
*/
+ @Override
protected Class<?>[] getReflectableClassesImpl() throws Exception {
return REFLECTABLE_CLASSES;
}
@@ -43,6 +42,7 @@ public class NamedEntityCollectionReflec
/**
* {@inheritDoc}
*/
+ @Override
protected boolean isEntity(Object bean, String propertyName)
throws Exception {
return ContainerUtils.contains(((NamedEntityCollection) bean)
@@ -52,6 +52,7 @@ public class NamedEntityCollectionReflec
/**
* {@inheritDoc}
*/
+ @Override
protected Entity getEntity(Object bean, String propertyName)
throws Exception {
return ((NamedEntityCollection) bean).getChild(propertyName);
@@ -60,12 +61,10 @@ public class NamedEntityCollectionReflec
/**
* {@inheritDoc}
*/
+ @Override
protected String[] getPropertyNamesImpl(Object bean) throws Exception {
- HashSet<String> result = new HashSet<String>(Arrays.asList(super
- .getPropertyNamesImpl(bean)));
- result.addAll(Arrays.asList(((NamedEntityCollection) bean)
- .getChildNames()));
- return result.toArray(new String[result.size()]);
+ return ArrayUtils.addAll(super.getPropertyNamesImpl(bean),
+ ((NamedEntityCollection) bean).getChildNames());
}
}