BeanUtils static methods imported in static way
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/digester/trunk@1142254 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/main/java/org/apache/commons/digester3/SetNestedPropertiesRule.java b/src/main/java/org/apache/commons/digester3/SetNestedPropertiesRule.java
index c03dbdb..107c711 100644
--- a/src/main/java/org/apache/commons/digester3/SetNestedPropertiesRule.java
+++ b/src/main/java/org/apache/commons/digester3/SetNestedPropertiesRule.java
@@ -19,6 +19,9 @@
* under the License.
*/
+import static org.apache.commons.beanutils.BeanUtils.setProperty;
+import static org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptor;
+
import static java.lang.String.format;
import java.beans.PropertyDescriptor;
@@ -28,10 +31,8 @@
import java.util.List;
import java.util.Map;
-import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.beanutils.DynaBean;
import org.apache.commons.beanutils.DynaProperty;
-import org.apache.commons.beanutils.PropertyUtils;
import org.apache.commons.logging.Log;
import org.xml.sax.Attributes;
@@ -506,7 +507,7 @@
else
/* this is a standard JavaBean */
{
- PropertyDescriptor desc = PropertyUtils.getPropertyDescriptor( top, propName );
+ PropertyDescriptor desc = getPropertyDescriptor( top, propName );
if ( desc == null )
{
throw new NoSuchMethodException( "Bean has no property named " + propName );
@@ -516,7 +517,7 @@
try
{
- BeanUtils.setProperty( top, propName, text );
+ setProperty( top, propName, text );
}
catch ( NullPointerException e )
{
diff --git a/src/main/java/org/apache/commons/digester3/SetPropertiesRule.java b/src/main/java/org/apache/commons/digester3/SetPropertiesRule.java
index b31179d..6ab4582 100644
--- a/src/main/java/org/apache/commons/digester3/SetPropertiesRule.java
+++ b/src/main/java/org/apache/commons/digester3/SetPropertiesRule.java
@@ -19,13 +19,13 @@
* under the License.
*/
+import static org.apache.commons.beanutils.BeanUtils.*;
+import static org.apache.commons.beanutils.PropertyUtils.*;
import static java.lang.String.format;
import java.util.HashMap;
import java.util.Map;
-import org.apache.commons.beanutils.BeanUtils;
-import org.apache.commons.beanutils.PropertyUtils;
import org.xml.sax.Attributes;
/**
@@ -200,7 +200,7 @@
// compatible so we'll accept the risk here.
Object top = getDigester().peek();
- boolean test = PropertyUtils.isWriteable( top, attributeName );
+ boolean test = isWriteable( top, attributeName );
if ( !test )
{
throw new NoSuchMethodException( "Property " + attributeName + " can't be set" );
@@ -229,7 +229,7 @@
getDigester().getMatch() ) );
}
}
- BeanUtils.populate( top, values );
+ populate( top, values );
}
/**
diff --git a/src/main/java/org/apache/commons/digester3/SetPropertyRule.java b/src/main/java/org/apache/commons/digester3/SetPropertyRule.java
index 0e89590..0166df5 100644
--- a/src/main/java/org/apache/commons/digester3/SetPropertyRule.java
+++ b/src/main/java/org/apache/commons/digester3/SetPropertyRule.java
@@ -20,13 +20,13 @@
*/
import static java.lang.String.format;
+import static org.apache.commons.beanutils.BeanUtils.setProperty;
+import static org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptor;
import java.beans.PropertyDescriptor;
-import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.beanutils.DynaBean;
import org.apache.commons.beanutils.DynaProperty;
-import org.apache.commons.beanutils.PropertyUtils;
import org.xml.sax.Attributes;
/**
@@ -127,7 +127,7 @@
else
/* this is a standard JavaBean */
{
- PropertyDescriptor desc = PropertyUtils.getPropertyDescriptor( top, actualName );
+ PropertyDescriptor desc = getPropertyDescriptor( top, actualName );
if ( desc == null )
{
throw new NoSuchMethodException( "Bean has no property named " + actualName );
@@ -135,7 +135,7 @@
}
// Set the property (with conversion as necessary)
- BeanUtils.setProperty( top, actualName, actualValue );
+ setProperty( top, actualName, actualValue );
}
/**
diff --git a/src/main/java/org/apache/commons/digester3/annotations/utils/AnnotationUtils.java b/src/main/java/org/apache/commons/digester3/annotations/utils/AnnotationUtils.java
index a78c5eb..3294279 100644
--- a/src/main/java/org/apache/commons/digester3/annotations/utils/AnnotationUtils.java
+++ b/src/main/java/org/apache/commons/digester3/annotations/utils/AnnotationUtils.java
@@ -19,9 +19,9 @@
* under the License.
*/
-import java.lang.annotation.Annotation;
+import static org.apache.commons.beanutils.MethodUtils.invokeExactMethod;
-import org.apache.commons.beanutils.MethodUtils;
+import java.lang.annotation.Annotation;
/**
* Simple utility class to introspect annotations.
@@ -146,7 +146,7 @@
{
try
{
- return MethodUtils.invokeExactMethod( annotation, method, null );
+ return invokeExactMethod( annotation, method, null );
}
catch ( Throwable t )
{
diff --git a/src/main/java/org/apache/commons/digester3/plugins/strategies/LoaderFromClass.java b/src/main/java/org/apache/commons/digester3/plugins/strategies/LoaderFromClass.java
index 9bcfefa..7d6aef5 100644
--- a/src/main/java/org/apache/commons/digester3/plugins/strategies/LoaderFromClass.java
+++ b/src/main/java/org/apache/commons/digester3/plugins/strategies/LoaderFromClass.java
@@ -19,13 +19,14 @@
* under the License.
*/
+import static org.apache.commons.beanutils.MethodUtils.getAccessibleMethod;
+
import java.lang.reflect.Method;
-import org.apache.commons.beanutils.MethodUtils;
-import org.apache.commons.logging.Log;
import org.apache.commons.digester3.Digester;
import org.apache.commons.digester3.plugins.PluginException;
import org.apache.commons.digester3.plugins.RuleLoader;
+import org.apache.commons.logging.Log;
/**
* A RuleLoader which invokes a static method on a target class, leaving that method to actually instantiate and add new
@@ -116,7 +117,7 @@
throws PluginException
{
Class<?>[] paramSpec = { Digester.class, String.class };
- Method rulesMethod = MethodUtils.getAccessibleMethod( rulesClass, methodName, paramSpec );
+ Method rulesMethod = getAccessibleMethod( rulesClass, methodName, paramSpec );
return rulesMethod;
}
diff --git a/src/main/java/org/apache/commons/digester3/xmlrules/ObjectParamRule.java b/src/main/java/org/apache/commons/digester3/xmlrules/ObjectParamRule.java
index bf801d1..2cb1669 100644
--- a/src/main/java/org/apache/commons/digester3/xmlrules/ObjectParamRule.java
+++ b/src/main/java/org/apache/commons/digester3/xmlrules/ObjectParamRule.java
@@ -19,7 +19,8 @@
* under the License.
*/
-import org.apache.commons.beanutils.ConvertUtils;
+import static org.apache.commons.beanutils.ConvertUtils.convert;
+
import org.apache.commons.digester3.binder.LinkedRuleBuilder;
import org.apache.commons.digester3.binder.ObjectParamBuilder;
import org.apache.commons.digester3.binder.RulesBinder;
@@ -66,7 +67,7 @@
}
else
{
- param = ConvertUtils.convert( value, clazz );
+ param = convert( value, clazz );
}
ObjectParamBuilder<?> builder = linkedRuleBuilder.objectParam( param ).ofIndex( paramIndex );