You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by br...@apache.org on 2014/10/26 10:03:09 UTC
svn commit: r1634287 - in /commons/sandbox/beanutils2/trunk/src:
main/java/org/apache/commons/beanutils2/
test/java/org/apache/commons/beanutils2/
Author: britter
Date: Sun Oct 26 09:03:08 2014
New Revision: 1634287
URL: http://svn.apache.org/r1634287
Log:
Rename method valueOf(String) to valueForKey(String) since valueOf is already used as method name on the primitive wrapper types. Also change of(String) to valueOf(String).
Modified:
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultMappedPropertyGetterAccessor.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultMappedPropertySetterAccessor.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/MappedPropertyGetterAccessor.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/MappedPropertySetterAccessor.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/PropertyInterpreter.java
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/GetMappedPropertyTestCase.java
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/MapBeanTestCase.java
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/SetMappedPropertyTestCase.java
Modified: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultMappedPropertyGetterAccessor.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultMappedPropertyGetterAccessor.java?rev=1634287&r1=1634286&r2=1634287&view=diff
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultMappedPropertyGetterAccessor.java (original)
+++ commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultMappedPropertyGetterAccessor.java Sun Oct 26 09:03:08 2014
@@ -47,15 +47,15 @@ class DefaultMappedPropertyGetterAccesso
/**
* {@inheritDoc}
*/
- public BeanAccessor<?> of(String key) {
- Object mappedValue = valueOf(key);
+ public BeanAccessor<?> forKey(String key) {
+ Object mappedValue = valueForKey(key);
return BeanAccessorFactory.createBeanAccessor(mappedValue, bean.getClass(), mappedReadMethod);
}
/**
* {@inheritDoc}
*/
- public <V> V valueOf(String key) {
+ public <V> V valueForKey(String key) {
checkNotNull(key, "Can not get mapped property '%s' in bean of type '%s' for null!", propertyName,
bean.getClass().getName());
// V is determined by the user
Modified: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultMappedPropertySetterAccessor.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultMappedPropertySetterAccessor.java?rev=1634287&r1=1634286&r2=1634287&view=diff
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultMappedPropertySetterAccessor.java (original)
+++ commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultMappedPropertySetterAccessor.java Sun Oct 26 09:03:08 2014
@@ -38,7 +38,7 @@ final class DefaultMappedPropertySetterA
this.mappedSetterMethod = mappedSetterMethod;
}
- public BeanPropertySetter<B> of(String key) {
+ public BeanPropertySetter<B> forKey(String key) {
checkNotNull(key, "Can not get mapped property '%s' in bean of type '%s' for null!", propertyName,
bean.getClass().getName());
return new DefaultMappedPropertySetter<B>(bean, propertyName, mappedSetterMethod, key);
Modified: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/MappedPropertyGetterAccessor.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/MappedPropertyGetterAccessor.java?rev=1634287&r1=1634286&r2=1634287&view=diff
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/MappedPropertyGetterAccessor.java (original)
+++ commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/MappedPropertyGetterAccessor.java Sun Oct 26 09:03:08 2014
@@ -21,7 +21,7 @@ package org.apache.commons.beanutils2;
public interface MappedPropertyGetterAccessor {
- BeanAccessor<?> of(String key);
+ BeanAccessor<?> forKey(String key);
- <V> V valueOf(String key);
+ <V> V valueForKey(String key);
}
Modified: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/MappedPropertySetterAccessor.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/MappedPropertySetterAccessor.java?rev=1634287&r1=1634286&r2=1634287&view=diff
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/MappedPropertySetterAccessor.java (original)
+++ commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/MappedPropertySetterAccessor.java Sun Oct 26 09:03:08 2014
@@ -21,6 +21,6 @@ package org.apache.commons.beanutils2;
public interface MappedPropertySetterAccessor<B> {
- BeanPropertySetter<B> of(String key);
+ BeanPropertySetter<B> forKey(String key);
}
Modified: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/PropertyInterpreter.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/PropertyInterpreter.java?rev=1634287&r1=1634286&r2=1634287&view=diff
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/PropertyInterpreter.java (original)
+++ commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/PropertyInterpreter.java Sun Oct 26 09:03:08 2014
@@ -147,7 +147,7 @@ final class PropertyInterpreter {
String property = matcher.group(1);
String key = matcher.group(2);
- return beanAccessor.getMapped(property).of(key);
+ return beanAccessor.getMapped(property).forKey(key);
}
}
}
Modified: commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/GetMappedPropertyTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/GetMappedPropertyTestCase.java?rev=1634287&r1=1634286&r2=1634287&view=diff
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/GetMappedPropertyTestCase.java (original)
+++ commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/GetMappedPropertyTestCase.java Sun Oct 26 09:03:08 2014
@@ -58,58 +58,58 @@ public class GetMappedPropertyTestCase {
@Test(expected = NullPointerException.class)
public void getMappedIntNullKey()
throws Exception {
- on(testBean).getMapped("mappedIntProperty").of(null);
+ on(testBean).getMapped("mappedIntProperty").forKey(null);
}
@Test
public void getMappedUnknownKey()
throws Exception {
- BeanAccessor<?> result = on(testBean).getMapped("mappedProperty").of("unknownKey");
+ BeanAccessor<?> result = on(testBean).getMapped("mappedProperty").forKey("unknownKey");
assertNull(result.get());
}
@Test
public void getMappedMappedProperty()
throws Exception {
- BeanAccessor<?> result = on(testBean).getMapped("mappedProperty").of("First Key");
+ BeanAccessor<?> result = on(testBean).getMapped("mappedProperty").forKey("First Key");
assertEquals("First Value", result.get());
}
@Test
public void getMappedMappedIntProperty()
throws Exception {
- BeanAccessor<?> result = on(testBean).getMapped("mappedIntProperty").of("One");
+ BeanAccessor<?> result = on(testBean).getMapped("mappedIntProperty").forKey("One");
assertEquals(Integer.valueOf(1), result.get());
}
@Test
public void getMappedMappedObjects()
throws Exception {
- BeanAccessor<?> result = on(testBean).getMapped("mappedObjects").of("First Key");
+ BeanAccessor<?> result = on(testBean).getMapped("mappedObjects").forKey("First Key");
assertEquals("First Value", result.get());
}
@Test
public void getMappedValueUnknownKey() throws Exception {
- Object result = on(testBean).getMapped("mappedProperty").valueOf("unknownKey");
+ Object result = on(testBean).getMapped("mappedProperty").valueForKey("unknownKey");
assertNull(result);
}
@Test
public void getMappedValueMappedProperty() throws Exception {
- String result = on(testBean).getMapped("mappedProperty").valueOf("First Key");
+ String result = on(testBean).getMapped("mappedProperty").valueForKey("First Key");
assertEquals("First Value", result);
}
@Test
public void getMappedValueMappedIntProperty() throws Exception {
- Integer result = on(testBean).getMapped("mappedIntProperty").valueOf("One");
+ Integer result = on(testBean).getMapped("mappedIntProperty").valueForKey("One");
assertEquals(Integer.valueOf(1), result);
}
@Test(expected = PropertyGetterInvocationException.class)
public void getExceptionMapped() {
- on(exceptionBean).getMapped("exceptionMapped").of("A Key");
+ on(exceptionBean).getMapped("exceptionMapped").forKey("A Key");
}
@Test(expected = NoSuchPropertyException.class)
Modified: commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/MapBeanTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/MapBeanTestCase.java?rev=1634287&r1=1634286&r2=1634287&view=diff
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/MapBeanTestCase.java (original)
+++ commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/MapBeanTestCase.java Sun Oct 26 09:03:08 2014
@@ -220,7 +220,7 @@ public class MapBeanTestCase {
@Test
public void mapsReturnedFromMappedPropertiesAreWrappedCorrectly() throws Exception {
- assertEquals(Integer.valueOf(15), on(bean).getMapped("mappedMap").of("whatever").get("integerProperty").get());
+ assertEquals(Integer.valueOf(15), on(bean).getMapped("mappedMap").forKey("whatever").get("integerProperty").get());
}
@Test
Modified: commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/SetMappedPropertyTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/SetMappedPropertyTestCase.java?rev=1634287&r1=1634286&r2=1634287&view=diff
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/SetMappedPropertyTestCase.java (original)
+++ commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/SetMappedPropertyTestCase.java Sun Oct 26 09:03:08 2014
@@ -57,7 +57,7 @@ public class SetMappedPropertyTestCase {
@Test(expected = NullPointerException.class)
public void getMappedIntNullKey()
throws Exception {
- on(testBean).getMapped("mappedIntProperty").of(null);
+ on(testBean).getMapped("mappedIntProperty").forKey(null);
}
@Test
@@ -66,7 +66,7 @@ public class SetMappedPropertyTestCase {
assertNull(testBean.getMappedProperty("unknownKey"));
String value = "value";
- on(testBean).setMapped("mappedProperty").of("unknownKey").with(value);
+ on(testBean).setMapped("mappedProperty").forKey("unknownKey").with(value);
assertEquals(value, testBean.getMappedProperty("unknownKey"));
}
@@ -74,7 +74,7 @@ public class SetMappedPropertyTestCase {
public void setMappedMappedProperty()
throws Exception {
String value = "value";
- on(testBean).setMapped("mappedProperty").of("First Key").with(value);
+ on(testBean).setMapped("mappedProperty").forKey("First Key").with(value);
assertEquals(value, testBean.getMappedProperty("First Key"));
}
@@ -83,7 +83,7 @@ public class SetMappedPropertyTestCase {
throws Exception {
// FIXME we have to call the getter to initialize the internal map. Change TestBean instead?
testBean.getMappedIntProperty("One");
- on(testBean).setMapped("mappedIntProperty").of("One").with(Integer.valueOf(5));
+ on(testBean).setMapped("mappedIntProperty").forKey("One").with(Integer.valueOf(5));
assertEquals(5, testBean.getMappedIntProperty("One"));
}
@@ -91,13 +91,13 @@ public class SetMappedPropertyTestCase {
public void setMappedMappedObjects()
throws Exception {
String value = "Value";
- on(testBean).setMapped("mappedObjects").of("First Key").with(value);
+ on(testBean).setMapped("mappedObjects").forKey("First Key").with(value);
assertEquals(value, testBean.getMappedObjects("First Key"));
}
@Test(expected = PropertySetterInvocationException.class)
public void setExceptionMapped() {
- on(exceptionBean).setMapped("exceptionMapped").of("A Key").with(new RuntimeException());
+ on(exceptionBean).setMapped("exceptionMapped").forKey("A Key").with(new RuntimeException());
}
@Test(expected = NoSuchPropertyException.class)