You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by jc...@apache.org on 2013/07/30 05:42:37 UTC
svn commit: r1508288 - in /commons/proper/proxy/branches/version-2.0-work:
core/src/main/java/org/apache/commons/proxy2/interceptor/matcher/argument/
stub/src/main/java/org/apache/commons/proxy2/stub/
Author: jcarman
Date: Tue Jul 30 03:42:37 2013
New Revision: 1508288
URL: http://svn.apache.org/r1508288
Log:
Fixing Sonar issues.
Modified:
commons/proper/proxy/branches/version-2.0-work/core/src/main/java/org/apache/commons/proxy2/interceptor/matcher/argument/ArgumentMatcherUtils.java
commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/StubConfiguration.java
commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/TrainingContext.java
Modified: commons/proper/proxy/branches/version-2.0-work/core/src/main/java/org/apache/commons/proxy2/interceptor/matcher/argument/ArgumentMatcherUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/core/src/main/java/org/apache/commons/proxy2/interceptor/matcher/argument/ArgumentMatcherUtils.java?rev=1508288&r1=1508287&r2=1508288&view=diff
==============================================================================
--- commons/proper/proxy/branches/version-2.0-work/core/src/main/java/org/apache/commons/proxy2/interceptor/matcher/argument/ArgumentMatcherUtils.java (original)
+++ commons/proper/proxy/branches/version-2.0-work/core/src/main/java/org/apache/commons/proxy2/interceptor/matcher/argument/ArgumentMatcherUtils.java Tue Jul 30 03:42:37 2013
@@ -3,7 +3,7 @@ package org.apache.commons.proxy2.interc
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.proxy2.interceptor.matcher.ArgumentMatcher;
-public class ArgumentMatcherUtils
+public final class ArgumentMatcherUtils
{
//----------------------------------------------------------------------------------------------------------------------
// Static Methods
@@ -40,6 +40,15 @@ public class ArgumentMatcherUtils
}
//----------------------------------------------------------------------------------------------------------------------
+// Constructors
+//----------------------------------------------------------------------------------------------------------------------
+
+ private ArgumentMatcherUtils()
+ {
+
+ }
+
+//----------------------------------------------------------------------------------------------------------------------
// Inner Classes
//----------------------------------------------------------------------------------------------------------------------
Modified: commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/StubConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/StubConfiguration.java?rev=1508288&r1=1508287&r2=1508288&view=diff
==============================================================================
--- commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/StubConfiguration.java (original)
+++ commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/StubConfiguration.java Tue Jul 30 03:42:37 2013
@@ -71,11 +71,11 @@ public interface StubConfiguration {
/**
* "when(...)"
- * @param <RT>
+ * @param <R>
* @param call
* @return {@link When}
*/
- <RT> When<RT> when(RT call);
+ <R> When<R> when(R call);
/**
* Intermediate result of a when(boolean[]) call
Modified: commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/TrainingContext.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/TrainingContext.java?rev=1508288&r1=1508287&r2=1508288&view=diff
==============================================================================
--- commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/TrainingContext.java (original)
+++ commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/TrainingContext.java Tue Jul 30 03:42:37 2013
@@ -87,7 +87,7 @@ public class TrainingContext
}
else if (matchersArray.length == arguments.length)
{
- this.matcher = new ArgumentMatchersMatcher(invocation, matchersArray);
+ this.matcher = new MatchingArgumentsMatcher(invocation, matchersArray);
}
else
{
@@ -100,12 +100,29 @@ public class TrainingContext
// Inner Classes
//----------------------------------------------------------------------------------------------------------------------
- private static class ArgumentMatchersMatcher implements InvocationMatcher
+ private static final class ExactArgumentsMatcher implements InvocationMatcher
+ {
+ private final RecordedInvocation recordedInvocation;
+
+ private ExactArgumentsMatcher(RecordedInvocation recordedInvocation)
+ {
+ this.recordedInvocation = recordedInvocation;
+ }
+
+ @Override
+ public boolean matches(Invocation invocation)
+ {
+ return invocation.getMethod().equals(recordedInvocation.getInvokedMethod()) &&
+ Arrays.deepEquals(invocation.getArguments(), recordedInvocation.getArguments());
+ }
+ }
+
+ private static final class MatchingArgumentsMatcher implements InvocationMatcher
{
private final RecordedInvocation recordedInvocation;
private final ArgumentMatcher[] matchers;
- private ArgumentMatchersMatcher(RecordedInvocation recordedInvocation, ArgumentMatcher[] matchers)
+ private MatchingArgumentsMatcher(RecordedInvocation recordedInvocation, ArgumentMatcher[] matchers)
{
this.recordedInvocation = recordedInvocation;
this.matchers = ArrayUtils.clone(matchers);
@@ -131,21 +148,4 @@ public class TrainingContext
return true;
}
}
-
- private static class ExactArgumentsMatcher implements InvocationMatcher
- {
- private final RecordedInvocation recordedInvocation;
-
- private ExactArgumentsMatcher(RecordedInvocation recordedInvocation)
- {
- this.recordedInvocation = recordedInvocation;
- }
-
- @Override
- public boolean matches(Invocation invocation)
- {
- return invocation.getMethod().equals(recordedInvocation.getInvokedMethod()) &&
- Arrays.deepEquals(invocation.getArguments(), recordedInvocation.getArguments());
- }
- }
}