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/05/03 15:14:55 UTC
svn commit: r1592200 [1/9] - in /commons/sandbox/beanutils2/trunk: config/
src/changes/ src/main/java/org/apache/commons/beanutils2/
src/main/java/org/apache/commons/beanutils2/transformers/
src/test/java/org/apache/commons/beanutils2/ src/test/java/or...
Author: britter
Date: Sat May 3 13:14:53 2014
New Revision: 1592200
URL: http://svn.apache.org/r1592200
Log:
SANDBOX-474: Change Codestyle to Sun/Eclipse formatting with spaces
Modified:
commons/sandbox/beanutils2/trunk/config/checkstyle.xml
commons/sandbox/beanutils2/trunk/src/changes/changes.xml
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/AccessibleObjectsRegistry.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/Argument.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/ArgumentsAccessor.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/Assertions.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanAccessor.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanClassNotFoundException.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanInstantiationException.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanProperties.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanPropertySetter.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanReflectionException.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanUtils.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/ClassAccessor.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/ClassLoaderBuilder.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/ConstructorInvocationException.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/ConstructorNotAccessibleException.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultArgumentsAccessor.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultBeanAccessor.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultBeanProperties.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultBeanPropertySetter.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultClassAccessor.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultClassLoaderBuilder.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultIndexedPropertyGetterAccessor.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultIndexedPropertySetter.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultIndexedPropertySetterAccessor.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultMappedPropertyGetterAccessor.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultMappedPropertySetter.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/IndexedPropertyGetterAccessor.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/IndexedPropertySetterAccessor.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/MappedPropertyDescriptor.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/MethodInvocationException.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/MethodNotAccessibleException.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/MethodUtils.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/NoSuchBeanMethodException.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/NoSuchConstructorException.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/NoSuchPropertyException.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/NullBeanAccessor.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/PropertyDescriptorsRegistry.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/PropertyGetterInvocationException.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/PropertyGetterNotAccessibleException.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/PropertyInterpreter.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/PropertyNotReadableException.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/PropertyNotWritableException.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/PropertySetterInvocationException.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/PropertySetterNotAccessibleException.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/Transformer.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/TypeUtils.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/package-info.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/transformers/AbstractTransformer.java
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/transformers/package-info.java
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/ArgumentTest.java
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/AssertionsTest.java
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/BeanUtilsTest.java
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/CastTestCase.java
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/CloneTestCase.java
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/ConstructorRegistryTestCase.java
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/ConstructorsTestCase.java
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/CopyPropertiesTestCase.java
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/DescribeTestCase.java
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/GetIndexedPropertyTestCase.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/GetPropertyTestCase.java
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/HasPropertyTestCase.java
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/IsReadableTestCase.java
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/IsWritableTestCase.java
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/MappedPropertyTestCase.java
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/MethodUtilsTest.java
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/MethodsRegistryTestCase.java
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/MethodsTestCase.java
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/OnClassNameTestCase.java
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/PopulateTestCase.java
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/PropertyInterpreterTestCase.java
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/SetIndexedPropertyTestCase.java
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/SetMappedPropertyTestCase.java
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/SetPropertyTestCase.java
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/StaticMethodsTestCase.java
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/TypeUtilsTest.java
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/VoidMethodsTestCase.java
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/issues/JiraSandbox433TestCase.java
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/testbeans/AbstractTestBean.java
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/testbeans/MappedPropertyChildBean.java
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/testbeans/MappedPropertyChildInterface.java
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/testbeans/MappedPropertyTestBean.java
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/testbeans/MappedPropertyTestInterface.java
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/testbeans/TestBean.java
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/testbeans/TestBeanUtils.java
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/testbeans/ThrowingExceptionBean.java
Modified: commons/sandbox/beanutils2/trunk/config/checkstyle.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/config/checkstyle.xml?rev=1592200&r1=1592199&r2=1592200&view=diff
==============================================================================
--- commons/sandbox/beanutils2/trunk/config/checkstyle.xml (original)
+++ commons/sandbox/beanutils2/trunk/config/checkstyle.xml Sat May 3 13:14:53 2014
@@ -34,174 +34,22 @@ under the License.
-->
<module name="Checker">
-
- <!-- Checks that each Java package has a Javadoc file used for commenting. -->
- <!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocPackage -->
- <!--module name="JavadocPackage">
- <property name="allowLegacy" value="true"/>
- </module-->
-
- <!-- Checks whether files end with a new line. -->
- <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
- <!-- module name="NewlineAtEndOfFile"/ -->
-
- <!-- Checks that property files contain the same keys. -->
- <!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
- <!-- module name="Translation"/ -->
-
- <module name="FileLength"/>
-
- <!-- Checks for Headers -->
- <!-- See http://checkstyle.sf.net/config_header.html -->
- <module name="RegexpHeader">
- <property name="headerFile" value="${checkstyle.header.file}"/>
- </module>
-
+ <property name="localeLanguage" value="en"/>
<module name="FileTabCharacter">
- <property name="eachLine" value="true"/>
- </module>
-
- <!-- Line with trailing spaces (disabled as it's too noisy) -->
- <!--<module name="RegexpSingleline">
- <property name="format" value="\s+$"/>
- <property name="message" value="Line has trailing spaces."/>
- </module>-->
-
+ <property name="fileExtensions" value="java,xml"/>
+ </module>
<module name="TreeWalker">
-
- <property name="cacheFile" value="${checkstyle.cache.file}"/>
-
- <property name="tabWidth" value="4"/>
-
- <module name="LeftCurly">
- <property name="option" value="nl"/>
- </module>
-
- <module name="RightCurly">
- <property name="option" value="alone"/>
- </module>
-
- <module name="LineLength">
- <property name="max" value="120" />
- <property name="ignorePattern" value="@version|@see|@todo|TODO"/>
- </module>
-
- <module name="MemberName" />
-
- <!-- Checks for Javadoc comments. -->
- <!-- See http://checkstyle.sf.net/config_javadoc.html -->
- <module name="JavadocMethod">
- <property name="severity" value="warning"/>
- <property name="scope" value="protected"/>
- <property name="allowUndeclaredRTE" value="true"/>
- </module>
- <module name="JavadocType">
- <property name="scope" value="protected"/>
- </module>
- <module name="JavadocVariable">
- <property name="severity" value="info"/>
- <property name="scope" value="protected"/>
- </module>
-
-
- <!-- Checks for Naming Conventions. -->
- <!-- See http://checkstyle.sf.net/config_naming.html -->
- <module name="ConstantName"/>
- <module name="LocalFinalVariableName"/>
- <module name="LocalVariableName"/>
- <module name="MethodName"/>
- <module name="PackageName"/>
- <module name="ParameterName"/>
- <module name="StaticVariableName"/>
- <module name="TypeName"/>
-
- <!-- Checks for imports -->
- <!-- See http://checkstyle.sf.net/config_import.html -->
+ <property name="cacheFile" value="target/cachefile"/>
<module name="AvoidStarImport"/>
- <module name="IllegalImport"/>
<module name="RedundantImport"/>
<module name="UnusedImports"/>
-
-
- <!-- Checks for Size Violations. -->
- <!-- See http://checkstyle.sf.net/config_sizes.html -->
- <module name="MethodLength"/>
- <module name="ParameterNumber"/>
-
-
- <!-- Checks for whitespace -->
- <!-- See http://checkstyle.sf.net/config_whitespace.html -->
- <module name="EmptyForIteratorPad">
- <property name="option" value="space"/>
- </module>
- <!-- module name="NoWhitespaceAfter"/ -->
- <!-- module name="NoWhitespaceBefore"/ -->
- <module name="OperatorWrap"/>
- <module name="ParenPad">
- <property name="option" value="space" />
- </module>
- <module name="WhitespaceAfter"/>
- <module name="WhitespaceAround"/>
- <!-- module name="MethodParamPad"/ -->
-
-
- <!-- Modifier Checks -->
- <!-- See http://checkstyle.sf.net/config_modifiers.html -->
- <module name="ModifierOrder"/>
- <module name="RedundantModifier"/>
-
-
- <!-- Checks for blocks. You know, those {}'s -->
- <!-- See http://checkstyle.sf.net/config_blocks.html -->
- <module name="AvoidNestedBlocks"/>
- <module name="EmptyBlock">
- <property name="option" value="text"/>
- </module>
<module name="NeedBraces"/>
-
-
- <!-- Checks for common coding problems -->
- <!-- See http://checkstyle.sf.net/config_coding.html -->
- <!-- module name="AvoidInlineConditionals"/ -->
- <module name="DoubleCheckedLocking"/>
- <module name="EmptyStatement"/>
- <module name="EqualsHashCode"/>
- <module name="HiddenField">
- <property name="severity" value="warning"/>
- <property name="ignoreSetter" value="true"/>
- <property name="ignoreConstructorParameter" value="true"/>
+ <module name="RedundantThrows">
+ <property name="allowUnchecked" value="true"/>
</module>
- <module name="IllegalInstantiation"/>
- <module name="InnerAssignment"/>
- <module name="MagicNumber">
- <!-- some numbers are really not that magic -->
- <property name="ignoreNumbers" value="-4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 32, 64, 100, 128, 256, 512, 1000, 1024"/>
- </module>
- <module name="MissingSwitchDefault"/>
- <module name="RedundantThrows"/>
- <module name="SimplifyBooleanExpression"/>
- <module name="SimplifyBooleanReturn"/>
-
- <!-- Checks for class design -->
- <!-- See http://checkstyle.sf.net/config_design.html -->
- <!-- module name="DesignForExtension"/ -->
- <!-- module name="FinalClass"/ -->
- <!-- module name="HideUtilityClassConstructor"/ -->
- <module name="InterfaceIsType"/>
- <module name="VisibilityModifier">
- <property name="protectedAllowed" value="true"/>
- <property name="packageAllowed" value="true"/>
+ <module name="JavadocMethod">
+ <property name="allowUndeclaredRTE" value="true"/>
</module>
-
- <!-- Miscellaneous other checks. -->
- <!-- See http://checkstyle.sf.net/config_misc.html -->
- <!-- module name="ArrayTypeStyle"/ -->
- <!-- module name="FinalParameters"/ -->
- <!-- Let todo plugin handle this.
- <module name="TodoComment"/>
- -->
- <module name="UpperEll"/>
-
</module>
</module>
Modified: commons/sandbox/beanutils2/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/changes/changes.xml?rev=1592200&r1=1592199&r2=1592200&view=diff
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/changes/changes.xml (original)
+++ commons/sandbox/beanutils2/trunk/src/changes/changes.xml Sat May 3 13:14:53 2014
@@ -23,6 +23,9 @@
</properties>
<body>
<release version="0.1" date="201?-??-??" description="First release.">
+ <action dev="britter" type="update" issue="SANDBOX-474">
+ Change Codestyle to Sun/Eclipse formatting with spaces
+ </action>
<action dev="britter" due-to="André Diermann" type="update" issue="SANDBOX-471">
Typos and codestyle violations in GetPropertyTestCase
</action>
Modified: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/AccessibleObjectsRegistry.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/AccessibleObjectsRegistry.java?rev=1592200&r1=1592199&r2=1592200&view=diff
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/AccessibleObjectsRegistry.java (original)
+++ commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/AccessibleObjectsRegistry.java Sat May 3 13:14:53 2014
@@ -1,5 +1,3 @@
-package org.apache.commons.beanutils2;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -19,6 +17,8 @@ package org.apache.commons.beanutils2;
* under the License.
*/
+package org.apache.commons.beanutils2;
+
import static java.lang.System.getSecurityManager;
import static java.lang.reflect.Modifier.isPublic;
import static java.security.AccessController.doPrivileged;
@@ -38,8 +38,7 @@ import java.util.WeakHashMap;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
-abstract class AccessibleObjectsRegistry<AO extends AccessibleObject & Member>
-{
+abstract class AccessibleObjectsRegistry<AO extends AccessibleObject & Member> {
// extracted from BeanUtils1
private static final float NON_FOUND_COST = 1.5f;
@@ -56,58 +55,102 @@ abstract class AccessibleObjectsRegistry
private static final AccessibleObjectsRegistry<Constructor<?>> CONSTRUCTORS_REGISTRY = new ConstructorsRegistry();
private static final AccessibleObjectsRegistry<Method> METHODS_REGISTRY = new MethodsRegistry();
+ private final Map<AccessibleObjectDescriptor, AO> cache = new WeakHashMap<AccessibleObjectDescriptor, AO>();
+
+ private AccessibleObjectsRegistry() {
+ // this class cannot be instantiated
+ }
- public static AccessibleObjectsRegistry<Constructor<?>> getConstructorsRegistry()
- {
+ public static AccessibleObjectsRegistry<Constructor<?>> getConstructorsRegistry() {
return CONSTRUCTORS_REGISTRY;
}
- public static AccessibleObjectsRegistry<Method> getMethodsRegistry()
- {
+ public static AccessibleObjectsRegistry<Method> getMethodsRegistry() {
return METHODS_REGISTRY;
}
- private final Map<AccessibleObjectDescriptor, AO> cache = new WeakHashMap<AccessibleObjectDescriptor, AO>();
+ /**
+ * Returns the sum of the object transformation cost for each class in the source argument list.
+ *
+ * @param srcArgs The source arguments
+ * @param destArgs The destination arguments
+ * @return The total transformation cost
+ */
+ private static float getTotalTransformationCost(Class<?>[] srcArgs, Class<?>[] destArgs) {
+ float totalCost = 0.0f;
+ for (int i = 0; i < srcArgs.length; i++) {
+ Class<?> srcClass, destClass;
+ srcClass = srcArgs[i];
+ destClass = destArgs[i];
+ totalCost += getObjectTransformationCost(srcClass, destClass);
+ }
+ return totalCost;
+ }
- private AccessibleObjectsRegistry()
- {
- // this class cannot be instantiated
+ /**
+ * Determines the costs of turning the source class into the destination class. This represents the weighted number
+ * of steps in the object hierarchy graph.
+ *
+ * @param srcClass The source class
+ * @param destClass The destination class
+ * @return The cost of transforming an object
+ */
+ private static float getObjectTransformationCost(Class<?> srcClass, Class<?> destClass) {
+ float cost = 0.0f;
+ while (srcClass != null && !destClass.equals(srcClass)) {
+ if (destClass.isPrimitive()) {
+ Class<?> destClassWrapperClazz = getPrimitiveWrapper(destClass);
+ if (destClassWrapperClazz != null && destClassWrapperClazz.equals(srcClass)) {
+ cost += WRAPPER_COST;
+ break;
+ }
+ }
+ if (destClass.isInterface() && isAssignmentCompatible(destClass, srcClass)) {
+ // slight penalty for interface match.
+ // we still want an exact match to override an interface match, but
+ // an interface match should override anything where we have to get a
+ // superclass.
+ cost += INTERFACE_COST;
+ break;
+ }
+ cost += SUPERCLASS_COST;
+ srcClass = srcClass.getSuperclass();
+ }
+
+
+ // If the destination class is null, we've travelled all the way up to an Object match.
+ if (srcClass == null) {
+ cost += NON_FOUND_COST;
+ }
+
+ return cost;
}
- public final AO get( boolean exact, Class<?> type, Class<?>... parameterTypes )
- {
- return get( exact, type, null, parameterTypes );
+ public final AO get(boolean exact, Class<?> type, Class<?>... parameterTypes) {
+ return get(exact, type, null, parameterTypes);
}
- public final AO get( boolean exact, Class<?> type, String name, Class<?>... parameterTypes )
- {
- AccessibleObjectDescriptor key = new AccessibleObjectDescriptor( exact, type, name, parameterTypes );
+ public final AO get(boolean exact, Class<?> type, String name, Class<?>... parameterTypes) {
+ AccessibleObjectDescriptor key = new AccessibleObjectDescriptor(exact, type, name, parameterTypes);
final Lock lock = new ReentrantLock();
lock.lock();
- try
- {
- AO accessibleObject = cache.get( key );
- if ( accessibleObject != null )
- {
+ try {
+ AO accessibleObject = cache.get(key);
+ if (accessibleObject != null) {
return accessibleObject;
}
// see if we can find the accessible object directly
// most of the time this works and it's much faster
- try
- {
- accessibleObject = resolveDirectly( type, name, parameterTypes );
- if ( exact || accessibleObject != null )
- {
- return makeAccessible( accessibleObject );
+ try {
+ accessibleObject = resolveDirectly(type, name, parameterTypes);
+ if (exact || accessibleObject != null) {
+ return makeAccessible(accessibleObject);
}
- }
- catch ( NoSuchMethodException e )
- {
+ } catch (NoSuchMethodException e) {
/* SWALLOW */
- if ( exact )
- {
+ if (exact) {
return null;
}
}
@@ -116,30 +159,24 @@ abstract class AccessibleObjectsRegistry
int paramSize = parameterTypes.length;
AO bestMatch = null;
- AO[] accessibleObjectsArray = getAccessibleObjectsArray( type );
+ AO[] accessibleObjectsArray = getAccessibleObjectsArray(type);
float bestMatchCost = Float.MAX_VALUE;
float myCost = Float.MAX_VALUE;
- for ( int i = 0, size = accessibleObjectsArray.length; i < size; i++ )
- {
- if ( matches( accessibleObjectsArray[i], name ) )
- {
+ for (int i = 0, size = accessibleObjectsArray.length; i < size; i++) {
+ if (matches(accessibleObjectsArray[i], name)) {
// compare parameters
- Class<?>[] methodsParams = getParameterTypes( accessibleObjectsArray[i] );
+ Class<?>[] methodsParams = getParameterTypes(accessibleObjectsArray[i]);
int methodParamSize = methodsParams.length;
- if ( methodParamSize == paramSize )
- {
- boolean match = checkTypesCompatible( methodsParams, parameterTypes );
+ if (methodParamSize == paramSize) {
+ boolean match = checkTypesCompatible(methodsParams, parameterTypes);
- if ( match )
- {
+ if (match) {
// get accessible version of method
- AO current = resolveAccessible( type, accessibleObjectsArray[i] );
- if ( current != null )
- {
+ AO current = resolveAccessible(type, accessibleObjectsArray[i]);
+ if (current != null) {
// determine which method the compiler would chose
- myCost = getTotalTransformationCost( parameterTypes, getParameterTypes( current ) );
- if ( myCost < bestMatchCost )
- {
+ myCost = getTotalTransformationCost(parameterTypes, getParameterTypes(current));
+ if (myCost < bestMatchCost) {
bestMatch = current;
bestMatchCost = myCost;
}
@@ -149,101 +186,31 @@ abstract class AccessibleObjectsRegistry
}
}
- if ( bestMatch != null )
- {
- bestMatch = makeAccessible( bestMatch );
+ if (bestMatch != null) {
+ bestMatch = makeAccessible(bestMatch);
}
- cache.put( key, bestMatch );
+ cache.put(key, bestMatch);
return bestMatch;
- }
- finally
- {
+ } finally {
lock.unlock();
}
}
- protected abstract AO resolveDirectly( Class<?> type, String name, Class<?>... parameterTypes )
- throws NoSuchMethodException;
-
- protected abstract AO[] getAccessibleObjectsArray( Class<?> type );
+ protected abstract AO resolveDirectly(Class<?> type, String name, Class<?>... parameterTypes)
+ throws NoSuchMethodException;
- protected abstract boolean matches( AO accessibleObject, String name );
+ protected abstract AO[] getAccessibleObjectsArray(Class<?> type);
- protected abstract Class<?>[] getParameterTypes( AO accessibleObject );
+ protected abstract boolean matches(AO accessibleObject, String name);
- protected abstract AO resolveAccessible( Class<?> type, AO accessibleObject );
+ protected abstract Class<?>[] getParameterTypes(AO accessibleObject);
- /**
- * Returns the sum of the object transformation cost for each class in the source argument list.
- *
- * @param srcArgs The source arguments
- * @param destArgs The destination arguments
- * @return The total transformation cost
- */
- private static float getTotalTransformationCost( Class<?>[] srcArgs, Class<?>[] destArgs )
- {
- float totalCost = 0.0f;
- for ( int i = 0; i < srcArgs.length; i++ )
- {
- Class<?> srcClass, destClass;
- srcClass = srcArgs[i];
- destClass = destArgs[i];
- totalCost += getObjectTransformationCost( srcClass, destClass );
- }
- return totalCost;
- }
+ protected abstract AO resolveAccessible(Class<?> type, AO accessibleObject);
- /**
- * Determines the costs of turning the source class into the destination class. This represents the weighted number
- * of steps in the object hierarchy graph.
- *
- * @param srcClass The source class
- * @param destClass The destination class
- * @return The cost of transforming an object
- */
- private static float getObjectTransformationCost( Class<?> srcClass, Class<?> destClass )
- {
- float cost = 0.0f;
- while ( srcClass != null && !destClass.equals( srcClass ) )
- {
- if ( destClass.isPrimitive() )
- {
- Class<?> destClassWrapperClazz = getPrimitiveWrapper( destClass );
- if ( destClassWrapperClazz != null && destClassWrapperClazz.equals( srcClass ) )
- {
- cost += WRAPPER_COST;
- break;
- }
- }
- if ( destClass.isInterface() && isAssignmentCompatible( destClass, srcClass ) )
- {
- // slight penalty for interface match.
- // we still want an exact match to override an interface match, but
- // an interface match should override anything where we have to get a
- // superclass.
- cost += INTERFACE_COST;
- break;
- }
- cost += SUPERCLASS_COST;
- srcClass = srcClass.getSuperclass();
- }
-
-
- // If the destination class is null, we've travelled all the way up to an Object match.
- if ( srcClass == null )
- {
- cost += NON_FOUND_COST;
- }
-
- return cost;
- }
-
- private AO makeAccessible( AO accessibleObject )
- {
- PrivilegedAction<AO> action = new MakeAccessiblePrivilegedAction<AO>( accessibleObject );
- if ( getSecurityManager() != null )
- {
- return doPrivileged( action );
+ private AO makeAccessible(AO accessibleObject) {
+ PrivilegedAction<AO> action = new MakeAccessiblePrivilegedAction<AO>(accessibleObject);
+ if (getSecurityManager() != null) {
+ return doPrivileged(action);
}
return action.run();
}
@@ -251,51 +218,42 @@ abstract class AccessibleObjectsRegistry
/**
* Constructors registry implementation.
*/
- private static class ConstructorsRegistry extends AccessibleObjectsRegistry<Constructor<?>>
- {
+ private static class ConstructorsRegistry extends AccessibleObjectsRegistry<Constructor<?>> {
@Override
- protected Constructor<?> resolveDirectly( Class<?> type, String name, Class<?>...parameterTypes )
- throws NoSuchMethodException
- {
- return type.getConstructor( parameterTypes );
+ protected Constructor<?> resolveDirectly(Class<?> type, String name, Class<?>... parameterTypes)
+ throws NoSuchMethodException {
+ return type.getConstructor(parameterTypes);
}
@Override
- protected Constructor<?>[] getAccessibleObjectsArray( Class<?> type )
- {
+ protected Constructor<?>[] getAccessibleObjectsArray(Class<?> type) {
return type.getConstructors();
}
@Override
- protected boolean matches( Constructor<?> accessibleObject, String name )
- {
+ protected boolean matches(Constructor<?> accessibleObject, String name) {
return true;
}
@Override
- protected Class<?>[] getParameterTypes( Constructor<?> accessibleObject )
- {
+ protected Class<?>[] getParameterTypes(Constructor<?> accessibleObject) {
return accessibleObject.getParameterTypes();
}
@Override
- protected Constructor<?> resolveAccessible( Class<?> type, Constructor<?> accessibleObject )
- {
- if ( accessibleObject == null )
- {
+ protected Constructor<?> resolveAccessible(Class<?> type, Constructor<?> accessibleObject) {
+ if (accessibleObject == null) {
return null;
}
- if ( !isPublic( accessibleObject.getModifiers() ) )
- {
+ if (!isPublic(accessibleObject.getModifiers())) {
return null;
}
// If the declaring class is public, we are done
Class<?> beanClass = accessibleObject.getDeclaringClass();
- if ( isPublic( beanClass.getModifiers() ) )
- {
+ if (isPublic(beanClass.getModifiers())) {
return accessibleObject;
}
@@ -308,103 +266,25 @@ abstract class AccessibleObjectsRegistry
/**
* Methods registry
*/
- private static final class MethodsRegistry extends AccessibleObjectsRegistry<Method>
- {
-
- @Override
- protected Method resolveDirectly( Class<?> type, String name, Class<?>...parameterTypes )
- throws NoSuchMethodException
- {
- return type.getMethod( name, parameterTypes );
- }
-
- @Override
- protected Method[] getAccessibleObjectsArray( Class<?> type )
- {
- return type.getMethods();
- }
-
- @Override
- protected boolean matches( Method accessibleObject, String name )
- {
- return name.equals( accessibleObject.getName() );
- }
-
- @Override
- protected Class<?>[] getParameterTypes( Method accessibleObject )
- {
- return accessibleObject.getParameterTypes();
- }
-
- @Override
- protected Method resolveAccessible( Class<?> type, Method method )
- {
- // Make sure we have a method to check
- if ( method == null )
- {
- return null;
- }
-
- // If the requested method is not public we cannot call it
- if ( !isPublic( method.getModifiers() ) )
- {
- return null;
- }
-
- if ( type == null )
- {
- type = method.getDeclaringClass();
- }
- else
- {
- checkArgument( method.getDeclaringClass().isAssignableFrom( type ),
- "%s is not assignable from ", type.getName(), method.getDeclaringClass().getName() );
- }
-
- // If the class is public, we are done
- if ( isPublic( type.getModifiers() ) )
- {
- return method;
- }
-
- String methodName = method.getName();
- Class<?>[] parameterTypes = method.getParameterTypes();
-
- // Check the implemented interfaces and subinterfaces
- method = getAccessibleMethodFromInterfaceNest( type, methodName, parameterTypes );
-
- // Check the superclass chain
- if ( method == null )
- {
- method = getAccessibleMethodFromSuperclass( type, methodName, parameterTypes );
- }
-
- return method;
- }
+ private static final class MethodsRegistry extends AccessibleObjectsRegistry<Method> {
/**
* <p>Return an accessible method (that is, one that can be invoked via
* reflection) by scanning through the superclasses. If no such method
* can be found, return <code>null</code>.</p>
*
- * @param clazz Class to be checked
- * @param methodName Method name of the method we wish to call
+ * @param clazz Class to be checked
+ * @param methodName Method name of the method we wish to call
* @param parameterTypes The parameter type signatures
*/
- private static Method getAccessibleMethodFromSuperclass( Class<?> clazz, String methodName,
- Class<?>... parameterTypes )
- {
+ private static Method getAccessibleMethodFromSuperclass(Class<?> clazz, String methodName,
+ Class<?>... parameterTypes) {
Class<?> parentClazz = clazz.getSuperclass();
- while ( parentClazz != null )
- {
- if ( isPublic( parentClazz.getModifiers() ) )
- {
- try
- {
- return parentClazz.getMethod( methodName, parameterTypes );
- }
- catch ( NoSuchMethodException e )
- {
+ while (parentClazz != null) {
+ if (isPublic(parentClazz.getModifiers())) {
+ try {
+ return parentClazz.getMethod(methodName, parameterTypes);
+ } catch (NoSuchMethodException e) {
// go ahead until found or parentClazz == null
}
}
@@ -418,52 +298,43 @@ abstract class AccessibleObjectsRegistry
* reflection) that implements the specified method, by scanning through
* all implemented interfaces and subinterfaces. If no such method
* can be found, return <code>null</code>.</p>
- *
+ * <p/>
* <p> There isn't any good reason why this method must be private.
* It is because there doesn't seem any reason why other classes should
* call this rather than the higher level methods.</p>
*
- * @param clazz Parent class for the interfaces to be checked
- * @param methodName Method name of the method we wish to call
+ * @param clazz Parent class for the interfaces to be checked
+ * @param methodName Method name of the method we wish to call
* @param parameterTypes The parameter type signatures
*/
- private static Method getAccessibleMethodFromInterfaceNest( Class<?> clazz, String methodName,
- Class<?>... parameterTypes )
- {
+ private static Method getAccessibleMethodFromInterfaceNest(Class<?> clazz, String methodName,
+ Class<?>... parameterTypes) {
Method method = null;
// Search up the superclass chain
- while ( clazz != null )
- {
+ while (clazz != null) {
// Check the implemented interfaces of the parent class
- for ( Class<?> interfaceType : clazz.getInterfaces() )
- {
+ for (Class<?> interfaceType : clazz.getInterfaces()) {
// Is this interface public?
- if ( !isPublic( interfaceType.getModifiers() ) )
- {
+ if (!isPublic(interfaceType.getModifiers())) {
continue;
}
// Does the method exist on this interface?
- try
- {
- method = interfaceType.getDeclaredMethod( methodName, parameterTypes );
- }
- catch ( NoSuchMethodException e )
- {
+ try {
+ method = interfaceType.getDeclaredMethod(methodName, parameterTypes);
+ } catch (NoSuchMethodException e) {
/*
* Swallow, if no method is found after the loop then this method returns null.
*/
}
- if ( method != null )
- {
+ if (method != null) {
return method;
}
// Recursively check our parent interfaces
- method = getAccessibleMethodFromInterfaceNest( interfaceType, methodName, parameterTypes );
- if ( method != null )
- {
+ method = getAccessibleMethodFromInterfaceNest(interfaceType, methodName, parameterTypes);
+ if (method != null) {
return method;
}
}
@@ -475,13 +346,71 @@ abstract class AccessibleObjectsRegistry
return null;
}
+ @Override
+ protected Method resolveDirectly(Class<?> type, String name, Class<?>... parameterTypes)
+ throws NoSuchMethodException {
+ return type.getMethod(name, parameterTypes);
+ }
+
+ @Override
+ protected Method[] getAccessibleObjectsArray(Class<?> type) {
+ return type.getMethods();
+ }
+
+ @Override
+ protected boolean matches(Method accessibleObject, String name) {
+ return name.equals(accessibleObject.getName());
+ }
+
+ @Override
+ protected Class<?>[] getParameterTypes(Method accessibleObject) {
+ return accessibleObject.getParameterTypes();
+ }
+
+ @Override
+ protected Method resolveAccessible(Class<?> type, Method method) {
+ // Make sure we have a method to check
+ if (method == null) {
+ return null;
+ }
+
+ // If the requested method is not public we cannot call it
+ if (!isPublic(method.getModifiers())) {
+ return null;
+ }
+
+ if (type == null) {
+ type = method.getDeclaringClass();
+ } else {
+ checkArgument(method.getDeclaringClass().isAssignableFrom(type),
+ "%s is not assignable from ", type.getName(), method.getDeclaringClass().getName());
+ }
+
+ // If the class is public, we are done
+ if (isPublic(type.getModifiers())) {
+ return method;
+ }
+
+ String methodName = method.getName();
+ Class<?>[] parameterTypes = method.getParameterTypes();
+
+ // Check the implemented interfaces and subinterfaces
+ method = getAccessibleMethodFromInterfaceNest(type, methodName, parameterTypes);
+
+ // Check the superclass chain
+ if (method == null) {
+ method = getAccessibleMethodFromSuperclass(type, methodName, parameterTypes);
+ }
+
+ return method;
+ }
+
}
/**
* Represents the key to looking up an AccessibleObject by reflection.
*/
- private static final class AccessibleObjectDescriptor
- {
+ private static final class AccessibleObjectDescriptor {
private final Class<?> type;
@@ -496,76 +425,64 @@ abstract class AccessibleObjectsRegistry
/**
* The sole constructor.
*
- * @param type the class to reflect, must not be null
- * @param methodName the method name to obtain
+ * @param type the class to reflect, must not be null
+ * @param methodName the method name to obtain
* @param parameterTypes the array of classes representing the parameter types
- * @param exact whether the match has to be exact.
+ * @param exact whether the match has to be exact.
*/
- public AccessibleObjectDescriptor( boolean exact, Class<?> type, String methodName, Class<?>... parameterTypes )
- {
+ public AccessibleObjectDescriptor(boolean exact, Class<?> type, String methodName, Class<?>... parameterTypes) {
final int prime = 31;
int hashCode = 1;
this.exact = exact;
- hashCode = prime * hashCode + ( exact ? 1231 : 1237 );
+ hashCode = prime * hashCode + (exact ? 1231 : 1237);
this.type = type;
- hashCode = prime * hashCode + ( ( type == null ) ? 0 : type.getName().hashCode() );
+ hashCode = prime * hashCode + ((type == null) ? 0 : type.getName().hashCode());
this.methodName = methodName;
- hashCode = prime * hashCode + ( ( methodName == null ) ? 0 : methodName.hashCode() );
+ hashCode = prime * hashCode + ((methodName == null) ? 0 : methodName.hashCode());
this.parameterTypes = parameterTypes;
- hashCode = prime * hashCode + Arrays.hashCode( parameterTypes );
+ hashCode = prime * hashCode + Arrays.hashCode(parameterTypes);
this.hashCode = hashCode;
}
@Override
- public int hashCode()
- {
+ public int hashCode() {
return hashCode;
}
@Override
- public boolean equals( Object obj )
- {
- if ( this == obj )
- {
+ public boolean equals(Object obj) {
+ if (this == obj) {
return true;
}
- if ( obj == null )
- {
+ if (obj == null) {
return false;
}
AccessibleObjectDescriptor other = (AccessibleObjectDescriptor) obj;
- if ( type != other.type )
- {
+ if (type != other.type) {
return false;
}
- if ( exact != other.exact )
- {
+ if (exact != other.exact) {
return false;
}
/* methodName can */
- if ( methodName == null )
- {
- if ( other.methodName != null )
- {
+ if (methodName == null) {
+ if (other.methodName != null) {
return false;
}
- }
- else if ( !methodName.equals( other.methodName ) )
- {
+ } else if (!methodName.equals(other.methodName)) {
return false;
}
- if ( !Arrays.equals( parameterTypes, other.parameterTypes ) )
- {
+ if (!Arrays.equals(parameterTypes, other.parameterTypes)) {
return false;
}
@@ -575,30 +492,24 @@ abstract class AccessibleObjectsRegistry
}
private static class MakeAccessiblePrivilegedAction<T extends AccessibleObject>
- implements PrivilegedAction<T>
- {
+ implements PrivilegedAction<T> {
private final T accessibleObject;
/**
* hidden constructor, this class cannot be instantiated directly
*/
- private MakeAccessiblePrivilegedAction( T accessibleObject )
- {
+ private MakeAccessiblePrivilegedAction(T accessibleObject) {
this.accessibleObject = accessibleObject;
}
/**
* {@inheritDoc}
*/
- public T run()
- {
- try
- {
- accessibleObject.setAccessible( true );
- }
- catch ( SecurityException se )
- {
+ public T run() {
+ try {
+ accessibleObject.setAccessible(true);
+ } catch (SecurityException se) {
/*
* Swallow SecurityException TODO: Why?
*/
Modified: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/Argument.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/Argument.java?rev=1592200&r1=1592199&r2=1592200&view=diff
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/Argument.java (original)
+++ commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/Argument.java Sat May 3 13:14:53 2014
@@ -1,5 +1,3 @@
-package org.apache.commons.beanutils2;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -19,6 +17,8 @@ package org.apache.commons.beanutils2;
* under the License.
*/
+package org.apache.commons.beanutils2;
+
import static org.apache.commons.beanutils2.Assertions.checkArgument;
import static org.apache.commons.beanutils2.Assertions.checkNotNull;
import static org.apache.commons.beanutils2.TypeUtils.isAssignmentCompatible;
@@ -29,58 +29,61 @@ import static org.apache.commons.beanuti
*
* @param <T> the type of the argument.
*/
-public final class Argument<T>
-{
+public final class Argument<T> {
+
+ private final Class<T> type;
+ private final T value;
+
+ private Argument(Class<T> type, T value) {
+ this.type = type;
+ this.value = value;
+ }
/**
* Factory method for arguments. Creates an argument by taking a value and determining the type of the given value.
*
* @param value the value to be wrapped by the new argument object. Must not be {@code null}! If you want to create
- * a null argument use {@link #nullArgument(Class)} instead.
- * @param <A> the type of the argument.
+ * a null argument use {@link #nullArgument(Class)} instead.
+ * @param <A> the type of the argument.
* @return a new argument of type {@code value.getClass()}
*/
- public static <A> Argument<A> argument( A value )
- {
- value = checkNotNull( value, "Null not supported when specifying value only" );
- @SuppressWarnings( "unchecked" )
+ public static <A> Argument<A> argument(A value) {
+ value = checkNotNull(value, "Null not supported when specifying value only");
+ @SuppressWarnings("unchecked")
Class<A> type = (Class<A>) value.getClass();
- return argument( type, value );
+ return argument(type, value);
}
/**
- * Creates a new null argument of the given type. Shortcut for {@code argument( type, null )}.
+ * Creates a new null argument of the given type. Shortcut for {@code argument(type, null)}.
*
* @param type the type of the new argument. Must not be {@code null}!
- * @param <A> the type of argument.
+ * @param <A> the type of argument.
* @return an argument with {@code value == null}.
*/
- public static <A> Argument<A> nullArgument( Class<A> type )
- {
- return argument( type, null );
+ public static <A> Argument<A> nullArgument(Class<A> type) {
+ return argument(type, null);
}
/**
* Creates a new argument of the given type with the given value.
*
- * @param type the type of the new argument. Must not be {@code null}!
+ * @param type the type of the new argument. Must not be {@code null}!
* @param value the value of the new argument.
- * @param <T> the type of the argument.
- * @param <V> the type of the value of the argument.
+ * @param <T> the type of the argument.
+ * @param <V> the type of the value of the argument.
* @return a new argument of the given type with the given value.
*/
- public static <T, V extends T> Argument<T> argument( Class<T> type, V value )
- {
- type = checkNotNull( type, "type must be specified (while value is nullable)" );
- if ( value != null )
- {
+ public static <T, V extends T> Argument<T> argument(Class<T> type, V value) {
+ type = checkNotNull(type, "type must be specified (while value is nullable)");
+ if (value != null) {
// this should never happen since the compiler prevents it. Check it anyway...
- checkArgument( isAssignmentCompatible( type, value.getClass() ),
- "value type %s does not match the given type %s",
- value.getClass().getName(),
- type.getName() );
+ checkArgument(isAssignmentCompatible(type, value.getClass()),
+ "value type %s does not match the given type %s",
+ value.getClass().getName(),
+ type.getName());
}
- return new Argument<T>( type, value );
+ return new Argument<T>(type, value);
}
/**
@@ -88,15 +91,13 @@ public final class Argument<T>
*
* @param arguments the arguments to determine the types of. None must be {@code null}!
* @return an array of {@code Class} objects representing the types of the
- * given arguments. The first {@code class} object represents the
- * type of the first argument and so on.
+ * given arguments. The first {@code class} object represents the
+ * type of the first argument and so on.
*/
- static Class<?>[] getParameterTypes( Argument<?>...arguments )
- {
+ static Class<?>[] getParameterTypes(Argument<?>... arguments) {
int argumentsLength = arguments.length;
Class<?>[] parameterTypes = new Class[argumentsLength];
- for ( int i = 0; i < argumentsLength; i++ )
- {
+ for (int i = 0; i < argumentsLength; i++) {
parameterTypes[i] = arguments[i].getType();
}
return parameterTypes;
@@ -108,37 +109,28 @@ public final class Argument<T>
* @param arguments the arguments to determine the types of. None must be {@code null}!
* @return an array of {@code Object}s representing the values of the given arguments.
*/
- static Object[] getParameters( Argument<?>...arguments )
- {
+ static Object[] getParameters(Argument<?>... arguments) {
int argumentsLength = arguments.length;
Object[] parameters = new Object[argumentsLength];
- for ( int i = 0; i < argumentsLength; i++ )
- {
+ for (int i = 0; i < argumentsLength; i++) {
parameters[i] = arguments[i].getValue();
}
return parameters;
}
- private final Class<T> type;
-
- private final T value;
-
- private Argument( Class<T> type, T value )
- {
- this.type = type;
- this.value = value;
- }
-
/**
- * Returns the argument's type. Note that the type returned maybe a super type of the actual type of the value
- * returned by {@link #getValue()} depending on how the argument was created. For example:
- * </br>{@code argument( Number.class, Integer.valueOf( 4 ) );}</br>
- * will create an argument with an Integer as Value but Number.class as type.
+ * Returns the argument's type.
+ *
+ * <p>Note that the type returned maybe a super type of the actual type of the value
+ * returned by {@link #getValue()} depending on how the argument was created. For example:</p>
+ * <pre>
+ * {@code argument(Number.class, Integer.valueOf(4));}
+ * </pre>
+ * <p>will create an argument with an Integer as Value but Number.class as type.</p>
*
* @return the argument's type
*/
- public Class<T> getType()
- {
+ public Class<T> getType() {
return type;
}
@@ -147,8 +139,7 @@ public final class Argument<T>
*
* @return the value of the argument.
*/
- public T getValue()
- {
+ public T getValue() {
return value;
}
Modified: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/ArgumentsAccessor.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/ArgumentsAccessor.java?rev=1592200&r1=1592199&r2=1592200&view=diff
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/ArgumentsAccessor.java (original)
+++ commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/ArgumentsAccessor.java Sat May 3 13:14:53 2014
@@ -1,5 +1,3 @@
-package org.apache.commons.beanutils2;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -19,11 +17,12 @@ package org.apache.commons.beanutils2;
* under the License.
*/
+package org.apache.commons.beanutils2;
+
/**
* A {@code ArgumentAccessor} can be used to pass arguments to a constructor or method.
*/
-public interface ArgumentsAccessor
-{
+public interface ArgumentsAccessor {
/**
* Passes the given arguments to the called constructor or method. Note that if you want to pass primitive
@@ -34,6 +33,6 @@ public interface ArgumentsAccessor
* @param arguments the arguments to be passed. May be empty.
* @return a {@link BeanAccessor} for the result of the method invocation.
*/
- BeanAccessor<?> with( Argument<?>... arguments );
+ BeanAccessor<?> with(Argument<?>... arguments);
}
Modified: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/Assertions.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/Assertions.java?rev=1592200&r1=1592199&r2=1592200&view=diff
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/Assertions.java (original)
+++ commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/Assertions.java Sat May 3 13:14:53 2014
@@ -1,5 +1,3 @@
-package org.apache.commons.beanutils2;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -19,19 +17,19 @@ package org.apache.commons.beanutils2;
* under the License.
*/
+package org.apache.commons.beanutils2;
+
import static java.lang.String.format;
/**
* Code partially extracted from Google Collections
*/
-final class Assertions
-{
+final class Assertions {
/**
* Hidden constructor, this class cannot be instantiated directly.
*/
- private Assertions()
- {
+ private Assertions() {
// do nothing
}
@@ -39,26 +37,24 @@ final class Assertions
* Ensures the truth of an expression involving one or more parameters to the
* calling method.
*
- * @param expression a boolean expression
+ * @param expression a boolean expression
* @param errorMessageTemplate a template for the exception message should the
- * check fail. The message is formed by replacing each {@code %s}
- * placeholder in the template with an argument. These are matched by
- * position - the first {@code %s} gets {@code errorMessageArgs[0]}, etc.
- * Unmatched arguments will be appended to the formatted message in square
- * braces. Unmatched placeholders will be left as-is.
- * @param errorMessageArgs the arguments to be substituted into the message
- * template. Arguments are converted to strings using
- * {@link String#valueOf(Object)}.
+ * check fail. The message is formed by replacing each {@code %s}
+ * placeholder in the template with an argument. These are matched by
+ * position - the first {@code %s} gets {@code errorMessageArgs[0]}, etc.
+ * Unmatched arguments will be appended to the formatted message in square
+ * braces. Unmatched placeholders will be left as-is.
+ * @param errorMessageArgs the arguments to be substituted into the message
+ * template. Arguments are converted to strings using
+ * {@link String#valueOf(Object)}.
* @throws IllegalArgumentException if {@code expression} is false
- * @throws NullPointerException if the check fails and either {@code
- * errorMessageTemplate} or {@code errorMessageArgs} is null (don't let
- * this happen)
+ * @throws NullPointerException if the check fails and either {@code
+ * errorMessageTemplate} or {@code errorMessageArgs} is null (don't let
+ * this happen)
*/
- public static void checkArgument( boolean expression, String errorMessageTemplate, Object... errorMessageArgs )
- {
- if ( !expression )
- {
- throw new IllegalArgumentException( format( errorMessageTemplate, errorMessageArgs ) );
+ public static void checkArgument(boolean expression, String errorMessageTemplate, Object... errorMessageArgs) {
+ if (!expression) {
+ throw new IllegalArgumentException(format(errorMessageTemplate, errorMessageArgs));
}
}
@@ -66,24 +62,22 @@ final class Assertions
* Ensures the truth of an expression involving the state of the calling
* instance, but not involving any parameters to the calling method.
*
- * @param expression a boolean expression
+ * @param expression a boolean expression
* @param errorMessageTemplate a template for the exception message should the
- * check fail. The message is formed by replacing each {@code %s}
- * placeholder in the template with an argument. These are matched by
- * position - the first {@code %s} gets {@code errorMessageArgs[0]}, etc.
- * Unmatched arguments will be appended to the formatted message in square
- * braces. Unmatched placeholders will be left as-is.
- * @param errorMessageArgs the arguments to be substituted into the message template.
+ * check fail. The message is formed by replacing each {@code %s}
+ * placeholder in the template with an argument. These are matched by
+ * position - the first {@code %s} gets {@code errorMessageArgs[0]}, etc.
+ * Unmatched arguments will be appended to the formatted message in square
+ * braces. Unmatched placeholders will be left as-is.
+ * @param errorMessageArgs the arguments to be substituted into the message template.
* @throws IllegalStateException if {@code expression} is false
- * @throws NullPointerException if the check fails and either {@code
- * errorMessageTemplate} or {@code errorMessageArgs} is null (don't let
- * this happen)
+ * @throws NullPointerException if the check fails and either {@code
+ * errorMessageTemplate} or {@code errorMessageArgs} is null (don't let
+ * this happen)
*/
- public static void checkState( boolean expression, String errorMessageTemplate, Object... errorMessageArgs )
- {
- if ( !expression )
- {
- throw new IllegalStateException( format( errorMessageTemplate, errorMessageArgs ) );
+ public static void checkState(boolean expression, String errorMessageTemplate, Object... errorMessageArgs) {
+ if (!expression) {
+ throw new IllegalStateException(format(errorMessageTemplate, errorMessageArgs));
}
}
@@ -91,25 +85,23 @@ final class Assertions
* Ensures that an object reference passed as a parameter to the calling
* method is not null.
*
- * @param reference an object reference
+ * @param reference an object reference
* @param errorMessageTemplate a template for the exception message should the
- * check fail. The message is formed by replacing each {@code %s}
- * placeholder in the template with an argument. These are matched by
- * position - the first {@code %s} gets {@code errorMessageArgs[0]}, etc.
- * Unmatched arguments will be appended to the formatted message in square
- * braces. Unmatched placeholders will be left as-is.
- * @param errorMessageArgs the arguments to be substituted into the message
- * template. Arguments are converted to strings using
- * {@link String#valueOf(Object)}.
+ * check fail. The message is formed by replacing each {@code %s}
+ * placeholder in the template with an argument. These are matched by
+ * position - the first {@code %s} gets {@code errorMessageArgs[0]}, etc.
+ * Unmatched arguments will be appended to the formatted message in square
+ * braces. Unmatched placeholders will be left as-is.
+ * @param errorMessageArgs the arguments to be substituted into the message
+ * template. Arguments are converted to strings using
+ * {@link String#valueOf(Object)}.
* @return the non-null reference that was validated
* @throws NullPointerException if {@code reference} is null
*/
- public static <T> T checkNotNull( T reference, String errorMessageTemplate, Object... errorMessageArgs )
- {
- if ( reference == null )
- {
+ public static <T> T checkNotNull(T reference, String errorMessageTemplate, Object... errorMessageArgs) {
+ if (reference == null) {
// If either of these parameters is null, the right thing happens anyway
- throw new NullPointerException( format( errorMessageTemplate, errorMessageArgs ) );
+ throw new NullPointerException(format(errorMessageTemplate, errorMessageArgs));
}
return reference;
}
@@ -120,15 +112,12 @@ final class Assertions
*
* @param references an array of object reference. Must not be {@code null}!
* @return the non-null reference that was validated
- * @throws NullPointerException
- * if one of the contained references is null or if {@code references} itself
- * is null (don't let this happen)
+ * @throws NullPointerException if one of the contained references is null or if {@code references} itself
+ * is null (don't let this happen)
*/
- public static <T> T[] checkNoneIsNull( T[] references )
- {
- for ( int i = 0; i < references.length; i++ )
- {
- checkNotNull( references[i], "Reference at index %s/%s is null!", i, references.length );
+ public static <T> T[] checkNoneIsNull(T[] references) {
+ for (int i = 0; i < references.length; i++) {
+ checkNotNull(references[i], "Reference at index %s/%s is null!", i, references.length);
}
return references;
}
Modified: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanAccessor.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanAccessor.java?rev=1592200&r1=1592199&r2=1592200&view=diff
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanAccessor.java (original)
+++ commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanAccessor.java Sat May 3 13:14:53 2014
@@ -1,5 +1,3 @@
-package org.apache.commons.beanutils2;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -19,6 +17,8 @@ package org.apache.commons.beanutils2;
* under the License.
*/
+package org.apache.commons.beanutils2;
+
import java.util.Map;
/**
@@ -26,8 +26,7 @@ import java.util.Map;
*
* @param <B> the type of the bean this BeanAcessor is associated with.
*/
-public interface BeanAccessor<B>
-{
+public interface BeanAccessor<B> {
// get
@@ -38,7 +37,7 @@ public interface BeanAccessor<B>
* @param propertyName the name of the property to get the value from. Must not be {@code null}!
* @return a {@code BeanAccessor} wrapping the properties value.
*/
- BeanAccessor<?> get( String propertyName );
+ BeanAccessor<?> get(String propertyName);
/**
* Selects the indexed property with name {@code propertyName} from the bean wrapped by this {@code BeanAccessor}. A
@@ -47,7 +46,7 @@ public interface BeanAccessor<B>
* @param propertyName the name of the indexed property to select. Must not be {@code null}!
* @return a {@link IndexedPropertyGetterAccessor} for specifying the index to return the value of.
*/
- IndexedPropertyGetterAccessor<?> getIndexed( String propertyName );
+ IndexedPropertyGetterAccessor<?> getIndexed(String propertyName);
/**
* Selects the mapped property with name {@code propertyName} from the bean wrapped by this {@code BeanAccessor}. A
@@ -56,7 +55,7 @@ public interface BeanAccessor<B>
* @param propertyName the name of the mapped property to select. Must not be {@code null}!
* @return a {@link MappedPropertyGetterAccessor} for specifying the key to return the value of.
*/
- MappedPropertyGetterAccessor getMapped( String propertyName );
+ MappedPropertyGetterAccessor getMapped(String propertyName);
/**
* Gets the bean wrapped by this {@code BeanAccessor}.
@@ -82,7 +81,7 @@ public interface BeanAccessor<B>
* @param propertyName the name of the property to select for setting a new value. Must not be {@code null}.
* @return a {@link BeanPropertySetter} for setting a new value.
*/
- BeanPropertySetter<B> set( String propertyName );
+ BeanPropertySetter<B> set(String propertyName);
/**
* Selects the indexed property with name {@code propertyName} for setting a new value. A
@@ -91,7 +90,7 @@ public interface BeanAccessor<B>
* @param propertyName the name of the indexed property to select for setting a new value. Must not be {@code null}.
* @return a {@link IndexedPropertySetterAccessor} for setting a new value.
*/
- IndexedPropertySetterAccessor<B> setIndexed( String propertyName );
+ IndexedPropertySetterAccessor<B> setIndexed(String propertyName);
/**
* Selects the mapped property with name {@code propertyName} for setting a new value. A
@@ -100,16 +99,18 @@ public interface BeanAccessor<B>
* @param propertyName the name of the mapped property to select for setting a new value. Must not be {@code null}.
* @return a {@link MappedPropertySetterAccessor} for setting a new value.
*/
- MappedPropertySetterAccessor<B> setMapped( String propertyName );
+ MappedPropertySetterAccessor<B> setMapped(String propertyName);
// clone
/**
* Clones a bean based on the available property getters and setters, even if the bean class itself does not
* implement Cloneable.
+ *
* <p>
* <strong>Note:</strong> this method creates a <strong>shallow</strong> clone. In other words, any objects referred
* to by the bean are shared with the clone rather than being cloned in turn.
+ * </p>
*
* @return the cloned bean
*/
@@ -121,42 +122,48 @@ public interface BeanAccessor<B>
* <p>
* <strong>Note</strong> that this method is intended to perform a "shallow copy" of the properties and so complex
* properties (for example, nested ones) will not be copied.
- * <p>
- * <strong>TODO</strong> should we implement something like the following?
- * <p>
- * If you know that no type conversions are required, the <code>copyProperties()</code> method in
- * {@link PropertyUtils} will execute faster than this method.
+ * </p>
* <p>
* <strong>FIXME</strong> - Indexed and mapped properties that do not have getter and setter methods for the
* underlying array or Map are not copied by this method.
+ * </p>
*
- * @param <T> the type of the bean to copy properties to.
+ * @param <T> the type of the bean to copy properties to.
* @param target the target to copy properties to from the wrapped bean
*/
- <T extends B> void copyPropertiesTo( T target );
+ <T extends B> void copyPropertiesTo(T target);
// description
/**
- * Return the entire set of properties for which the specified bean provides a read method. This map contains the
- * property names as keys and the property values as values, for all properties the bean provides a read method for
- * (i.e. where the getReadMethod() returns non-null).
+ * Return the entire set of properties for which the specified bean provides a read method.
+ *
+ * <p>
+ * The returned map contains the property names as keys and the property values as values, for all properties the bean
+ * provides a read method for (i.e. where the getReadMethod() returns non-null).
+ * </p>
* <p>
* This map can be fed back to a call to <code>BeanAccessor.populate()</code> to reconstitute the same set of
* properties, modulo differences for read-only and write-only properties, but only if there are no indexed
* properties.
+ * </p>
* <p>
* <strong>Warning:</strong> if any of the bean property implementations contain (directly or indirectly) a call to
- * this method then a stack overflow may result. For example: <code><pre>
+ * this method then a stack overflow may result. For example: </p>
+ * <pre>
+ * <code>
* class MyBean
* {
* public Map<String, Object> getParameterMap()
* {
- * on( this ).describe;
+ * on(this).describe;
* }
* }
- * </pre></code> will result in an infinite regression when <code>getParametersMap</code> is called. It is
+ * </code>
+ * </pre>
+ * <p>will result in an infinite regression when <code>getParametersMap</code> is called. It is
* recommended that such methods are given alternative names (for example, <code>parametersMap</code>).
+ * </p>
*
* @return Map that contains the property names as keys and property values as values.
*/
@@ -167,9 +174,9 @@ public interface BeanAccessor<B>
* this method has to specify names of properties to set and corresponding values as key-value-pairs.
*
* @param properties Map keyed by property name, with the corresponding value to be set.
- * Must not be {@code null}.
+ * Must not be {@code null}.
*/
- void populate( Map<String, Object> properties );
+ void populate(Map<String, Object> properties);
// methods invocation
@@ -180,7 +187,7 @@ public interface BeanAccessor<B>
* @param methodName the name of the method to invoke. Must not be {@code null}!
* @return an {@link ArgumentsAccessor} to specify arguments for the method invocation.
*/
- ArgumentsAccessor invoke( String methodName );
+ ArgumentsAccessor invoke(String methodName);
/**
* Invokes the method with name {@code methodName} and the exact arguments. An {@link ArgumentsAccessor} will be
@@ -189,6 +196,6 @@ public interface BeanAccessor<B>
* @param methodName the name of the method to invoke. Must not be {@code null}!
* @return a {@link ArgumentsAccessor} to specify any arguments
*/
- ArgumentsAccessor invokeExact( String methodName );
+ ArgumentsAccessor invokeExact(String methodName);
}
Modified: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanClassNotFoundException.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanClassNotFoundException.java?rev=1592200&r1=1592199&r2=1592200&view=diff
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanClassNotFoundException.java (original)
+++ commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanClassNotFoundException.java Sat May 3 13:14:53 2014
@@ -1,5 +1,3 @@
-package org.apache.commons.beanutils2;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -19,15 +17,15 @@ package org.apache.commons.beanutils2;
* under the License.
*/
+package org.apache.commons.beanutils2;
+
public class BeanClassNotFoundException
- extends BeanReflectionException
-{
+ extends BeanReflectionException {
private static final long serialVersionUID = 201207122218L;
- public BeanClassNotFoundException( String beanTypeName, Throwable cause )
- {
- super( cause, null, "Bean class '%s' could not be found!", beanTypeName );
+ public BeanClassNotFoundException(String beanTypeName, Throwable cause) {
+ super(cause, null, "Bean class '%s' could not be found!", beanTypeName);
}
}
Modified: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanInstantiationException.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanInstantiationException.java?rev=1592200&r1=1592199&r2=1592200&view=diff
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanInstantiationException.java (original)
+++ commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanInstantiationException.java Sat May 3 13:14:53 2014
@@ -1,5 +1,3 @@
-package org.apache.commons.beanutils2;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -19,20 +17,19 @@ package org.apache.commons.beanutils2;
* under the License.
*/
+package org.apache.commons.beanutils2;
+
public class BeanInstantiationException
- extends BeanReflectionException
-{
+ extends BeanReflectionException {
private static final long serialVersionUID = 201212072136L;
- public BeanInstantiationException( Class<?> beanType, Throwable cause )
- {
- super( cause, beanType, "Cannot not create a new instance of type '%s'.", beanType );
+ public BeanInstantiationException(Class<?> beanType, Throwable cause) {
+ super(cause, beanType, "Cannot not create a new instance of type '%s'.", beanType);
}
- BeanInstantiationException( Class<?> beanType, String reason )
- {
- super( null, beanType, "Cannot not create a new instance of type '%s'. Reason: " + reason, beanType );
+ BeanInstantiationException(Class<?> beanType, String reason) {
+ super(null, beanType, "Cannot not create a new instance of type '%s'. Reason: " + reason, beanType);
}
}
Modified: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanProperties.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanProperties.java?rev=1592200&r1=1592199&r2=1592200&view=diff
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanProperties.java (original)
+++ commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanProperties.java Sat May 3 13:14:53 2014
@@ -1,5 +1,3 @@
-package org.apache.commons.beanutils2;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -19,22 +17,23 @@ package org.apache.commons.beanutils2;
* under the License.
*/
+package org.apache.commons.beanutils2;
+
import java.beans.IndexedPropertyDescriptor;
import java.beans.PropertyDescriptor;
import java.lang.reflect.Method;
import java.util.Map;
-public interface BeanProperties<B>
-{
+public interface BeanProperties<B> {
/**
* Checks if the current bean type has a property identified by the input name.
*
* @param propertyName the name of the property to be checked.
* @return true if the current bean type has a property identified by the input name,
- * false otherwise.
+ * false otherwise.
*/
- boolean hasProperty( String propertyName );
+ boolean hasProperty(String propertyName);
/**
* Checks if the specified property name identifies a readable property.
@@ -42,7 +41,7 @@ public interface BeanProperties<B>
* @param propertyName the name of the property to be checked.
* @return {@code true}, if the property is readable.
*/
- boolean isReadable( String propertyName );
+ boolean isReadable(String propertyName);
/**
* Checks if the specified property name identifies a writable property.
@@ -50,59 +49,52 @@ public interface BeanProperties<B>
* @param propertyName the name of the property to be checked.
* @return {@code true}, if the property is writable.
*/
- boolean isWritable( String propertyName );
+ boolean isWritable(String propertyName);
/**
- *
- * @param propertyName
- * @return
+ * @param propertyName the name of the property
+ * @return the PropertyDescriptor of the property with the given name
*/
- PropertyDescriptor getPropertyDescriptor( String propertyName );
+ PropertyDescriptor getPropertyDescriptor(String propertyName);
/**
- *
- * @param propertyName
- * @return
+ * @param propertyName the name of the property to get the read method from
+ * @return the read method of the property with the given name
*/
- Method getReadPropertyMethod( String propertyName );
+ Method getReadPropertyMethod(String propertyName);
/**
- *
- * @param name
- * @return
+ * @param name the name of the property to get the write method from
+ * @return the write method of the property with the given name
*/
- Method getWriteMethod( String name );
+ Method getWriteMethod(String name);
/**
- *
- * @param propertyName
- * @return
+ * @param propertyName the name of the indexed property
+ * @return the IndexedPropertyDescriptor of the indexed property with the given name
*/
- IndexedPropertyDescriptor getIndexedPropertyDescriptor( String propertyName );
+ IndexedPropertyDescriptor getIndexedPropertyDescriptor(String propertyName);
/**
- *
- * @param propertyName
- * @return
+ * @param propertyName the name of the indexed property
+ * @return the read method of the indexed property with the given name
*/
- Method getIndexedReadMethod( String propertyName );
+ Method getIndexedReadMethod(String propertyName);
/**
- *
- * @param propertyName
- * @return
+ * @param propertyName the name of the indexed property
+ * @return the write method of the indexed property with the given name
*/
- Method getIndexedWriteMethod( String propertyName );
+ Method getIndexedWriteMethod(String propertyName);
- MappedPropertyDescriptor getMappedPropertyDescriptor( String propertyName );
+ MappedPropertyDescriptor getMappedPropertyDescriptor(String propertyName);
- Method getMappedReadMethod( String propertyName );
+ Method getMappedReadMethod(String propertyName);
/**
- *
- * @return
+ * @return the properties index
*/
Map<String, PropertyDescriptor> getPropertiesIndex();
- Method getMappedWriteMethod( String propertyName );
+ Method getMappedWriteMethod(String propertyName);
}
Modified: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanPropertySetter.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanPropertySetter.java?rev=1592200&r1=1592199&r2=1592200&view=diff
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanPropertySetter.java (original)
+++ commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanPropertySetter.java Sat May 3 13:14:53 2014
@@ -1,5 +1,3 @@
-package org.apache.commons.beanutils2;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -19,10 +17,10 @@ package org.apache.commons.beanutils2;
* under the License.
*/
+package org.apache.commons.beanutils2;
-public interface BeanPropertySetter<B>
-{
+public interface BeanPropertySetter<B> {
- <V> BeanAccessor<B> with( V value );
+ <V> BeanAccessor<B> with(V value);
}