You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by oh...@apache.org on 2013/10/17 22:28:20 UTC
svn commit: r1533250 -
/commons/proper/beanutils/branches/java5/src/main/java/org/apache/commons/beanutils/BeanUtils.java
Author: oheger
Date: Thu Oct 17 20:28:20 2013
New Revision: 1533250
URL: http://svn.apache.org/r1533250
Log:
Added generics.
Modified:
commons/proper/beanutils/branches/java5/src/main/java/org/apache/commons/beanutils/BeanUtils.java
Modified: commons/proper/beanutils/branches/java5/src/main/java/org/apache/commons/beanutils/BeanUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/branches/java5/src/main/java/org/apache/commons/beanutils/BeanUtils.java?rev=1533250&r1=1533249&r2=1533250&view=diff
==============================================================================
--- commons/proper/beanutils/branches/java5/src/main/java/org/apache/commons/beanutils/BeanUtils.java (original)
+++ commons/proper/beanutils/branches/java5/src/main/java/org/apache/commons/beanutils/BeanUtils.java Thu Oct 17 20:28:20 2013
@@ -176,7 +176,7 @@ public class BeanUtils {
* property cannot be found
* @see BeanUtilsBean#describe
*/
- public static Map describe(Object bean)
+ public static Map<String, String> describe(Object bean)
throws IllegalAccessException, InvocationTargetException,
NoSuchMethodException {
@@ -425,7 +425,7 @@ public class BeanUtils {
* throws an exception
* @see BeanUtilsBean#populate
*/
- public static void populate(Object bean, Map properties)
+ public static void populate(Object bean, Map<String, ? extends Object> properties)
throws IllegalAccessException, InvocationTargetException {
BeanUtilsBean.getInstance().populate(bean, properties);
@@ -468,11 +468,13 @@ public class BeanUtils {
/**
* Create a cache.
+ * @param <K> the key type of the cache
+ * @param <V> the value type of the cache
* @return a new cache
* @since 1.8.0
*/
- public static Map createCache() {
- return new WeakFastHashMap();
+ public static <K, V> Map<K, V> createCache() {
+ return new WeakFastHashMap<K, V>();
}
/**
@@ -481,9 +483,9 @@ public class BeanUtils {
* @return Whether it is fast or not.
* @since 1.8.0
*/
- public static boolean getCacheFast(Map map) {
+ public static boolean getCacheFast(Map<?, ?> map) {
if (map instanceof WeakFastHashMap) {
- return ((WeakFastHashMap)map).getFast();
+ return ((WeakFastHashMap<?, ?>) map).getFast();
} else {
return false;
}
@@ -495,9 +497,9 @@ public class BeanUtils {
* @param fast Whether it should be fast or not.
* @since 1.8.0
*/
- public static void setCacheFast(Map map, boolean fast) {
+ public static void setCacheFast(Map<?, ?> map, boolean fast) {
if (map instanceof WeakFastHashMap) {
- ((WeakFastHashMap)map).setFast(fast);
+ ((WeakFastHashMap<?, ?>)map).setFast(fast);
}
}
}