Permalink
Browse files

Add test cases and re-org packages

  • Loading branch information...
1 parent 2215ddd commit 9dd0346f31f6c2f082ff7b18595e55b8811dbcfa @dsyer dsyer committed Dec 21, 2010
Showing with 11,895 additions and 152 deletions.
  1. +25 −1 pom.xml
  2. +83 −0 src/main/java/org/springframework/classify/BackToBackPatternClassifier.java
  3. +1 −1 src/main/java/org/springframework/{commons → }/classify/BinaryExceptionClassifier.java
  4. +1 −1 src/main/java/org/springframework/{commons → }/classify/Classifier.java
  5. +101 −0 src/main/java/org/springframework/classify/ClassifierAdapter.java
  6. +2 −2 src/main/java/org/springframework/{commons → }/classify/ClassifierSupport.java
  7. +231 −0 src/main/java/org/springframework/classify/PatternMatcher.java
  8. +75 −0 src/main/java/org/springframework/classify/PatternMatchingClassifier.java
  9. +2 −2 src/main/java/org/springframework/{commons → }/classify/SubclassClassifier.java
  10. +38 −0 src/main/java/org/springframework/classify/annotation/Classifier.java
  11. +104 −0 src/main/java/org/springframework/classify/util/AnnotationMethodResolver.java
  12. +29 −0 src/main/java/org/springframework/classify/util/MethodInvoker.java
  13. +210 −0 src/main/java/org/springframework/classify/util/MethodInvokerUtils.java
  14. +57 −0 src/main/java/org/springframework/classify/util/MethodResolver.java
  15. +152 −0 src/main/java/org/springframework/classify/util/SimpleMethodInvoker.java
  16. +80 −0 src/main/java/org/springframework/repeat/CompletionPolicy.java
  17. +1 −1 src/main/java/org/springframework/{commons → }/repeat/RepeatCallback.java
  18. +1 −1 src/main/java/org/springframework/{commons → }/repeat/RepeatContext.java
  19. +1 −1 src/main/java/org/springframework/{commons → }/repeat/RepeatException.java
  20. +80 −0 src/main/java/org/springframework/repeat/RepeatListener.java
  21. +1 −1 src/main/java/org/springframework/{commons → }/repeat/RepeatOperations.java
  22. +1 −1 src/main/java/org/springframework/{commons → }/repeat/RepeatStatus.java
  23. +61 −0 src/main/java/org/springframework/repeat/callback/NestedRepeatCallback.java
  24. +7 −0 src/main/java/org/springframework/repeat/callback/package.html
  25. +115 −0 src/main/java/org/springframework/repeat/context/RepeatContextCounter.java
  26. +178 −0 src/main/java/org/springframework/repeat/context/RepeatContextSupport.java
  27. +161 −0 src/main/java/org/springframework/repeat/context/SynchronizedAttributeAccessor.java
  28. +7 −0 src/main/java/org/springframework/repeat/context/package.html
  29. +49 −0 src/main/java/org/springframework/repeat/exception/CompositeExceptionHandler.java
  30. +39 −0 src/main/java/org/springframework/repeat/exception/DefaultExceptionHandler.java
  31. +48 −0 src/main/java/org/springframework/repeat/exception/ExceptionHandler.java
  32. +111 −0 src/main/java/org/springframework/repeat/exception/LogOrRethrowExceptionHandler.java
  33. +150 −0 src/main/java/org/springframework/repeat/exception/RethrowOnThresholdExceptionHandler.java
  34. +147 −0 src/main/java/org/springframework/repeat/exception/SimpleLimitExceptionHandler.java
  35. +7 −0 src/main/java/org/springframework/repeat/exception/package.html
  36. +203 −0 src/main/java/org/springframework/repeat/interceptor/RepeatOperationsInterceptor.java
  37. +7 −0 src/main/java/org/springframework/repeat/interceptor/package.html
  38. +99 −0 src/main/java/org/springframework/repeat/listener/CompositeRepeatListener.java
  39. +46 −0 src/main/java/org/springframework/repeat/listener/RepeatListenerSupport.java
  40. +7 −0 src/main/java/org/springframework/repeat/listener/package.html
  41. +7 −0 src/main/java/org/springframework/repeat/package.html
  42. +77 −0 src/main/java/org/springframework/repeat/policy/CompletionPolicySupport.java
  43. +133 −0 src/main/java/org/springframework/repeat/policy/CompositeCompletionPolicy.java
  44. +132 −0 src/main/java/org/springframework/repeat/policy/CountingCompletionPolicy.java
  45. +53 −0 src/main/java/org/springframework/repeat/policy/DefaultResultCompletionPolicy.java
  46. +115 −0 src/main/java/org/springframework/repeat/policy/SimpleCompletionPolicy.java
  47. +98 −0 src/main/java/org/springframework/repeat/policy/TimeoutTerminationPolicy.java
  48. +7 −0 src/main/java/org/springframework/repeat/policy/package.html
  49. +37 −0 src/main/java/org/springframework/repeat/support/RepeatInternalState.java
  50. +35 −0 src/main/java/org/springframework/repeat/support/RepeatInternalStateSupport.java
  51. +104 −0 src/main/java/org/springframework/repeat/support/RepeatSynchronizationManager.java
  52. +476 −0 src/main/java/org/springframework/repeat/support/RepeatTemplate.java
  53. +52 −0 src/main/java/org/springframework/repeat/support/ResultHolder.java
  54. +176 −0 src/main/java/org/springframework/repeat/support/ResultHolderResultQueue.java
  55. +91 −0 src/main/java/org/springframework/repeat/support/ResultQueue.java
  56. +324 −0 src/main/java/org/springframework/repeat/support/TaskExecutorRepeatTemplate.java
  57. +105 −0 src/main/java/org/springframework/repeat/support/ThrottleLimitResultQueue.java
  58. +7 −0 src/main/java/org/springframework/repeat/support/package.html
  59. +1 −1 src/main/java/org/springframework/{commons → }/retry/ExhaustedRetryException.java
  60. +1 −1 src/main/java/org/springframework/{commons → }/retry/RecoveryCallback.java
  61. +1 −1 src/main/java/org/springframework/{commons → }/retry/RetryCallback.java
  62. +1 −1 src/main/java/org/springframework/{commons → }/retry/RetryContext.java
  63. +1 −1 src/main/java/org/springframework/{commons → }/retry/RetryException.java
  64. +1 −1 src/main/java/org/springframework/{commons → }/retry/RetryListener.java
  65. +2 −2 src/main/java/org/springframework/{commons → }/retry/RetryOperations.java
  66. +1 −1 src/main/java/org/springframework/{commons → }/retry/RetryPolicy.java
  67. +1 −1 src/main/java/org/springframework/{commons → }/retry/RetryState.java
  68. +1 −1 src/main/java/org/springframework/{commons → }/retry/RetryStatistics.java
  69. +1 −1 src/main/java/org/springframework/{commons → }/retry/TerminatedRetryException.java
  70. +1 −1 src/main/java/org/springframework/{commons → }/retry/backoff/BackOffContext.java
  71. +2 −2 src/main/java/org/springframework/{commons → }/retry/backoff/BackOffInterruptedException.java
  72. +4 −4 src/main/java/org/springframework/{commons → }/retry/backoff/BackOffPolicy.java
  73. +2 −2 src/main/java/org/springframework/{commons → }/retry/backoff/ExponentialBackOffPolicy.java
  74. +1 −1 src/main/java/org/springframework/{commons → }/retry/backoff/FixedBackOffPolicy.java
  75. +1 −1 src/main/java/org/springframework/{commons → }/retry/backoff/NoBackOffPolicy.java
  76. +2 −2 src/main/java/org/springframework/{commons → }/retry/backoff/ObjectWaitSleeper.java
  77. +1 −1 src/main/java/org/springframework/{commons → }/retry/backoff/Sleeper.java
  78. +2 −2 src/main/java/org/springframework/{commons → }/retry/backoff/StatelessBackOffPolicy.java
  79. +7 −0 src/main/java/org/springframework/retry/backoff/package.html
  80. +3 −3 src/main/java/org/springframework/{commons → }/retry/context/RetryContextSupport.java
  81. +7 −0 src/main/java/org/springframework/retry/context/package.html
  82. +1 −1 src/main/java/org/springframework/{commons → }/retry/interceptor/MethodArgumentsKeyGenerator.java
  83. +1 −1 src/main/java/org/springframework/{commons → }/retry/interceptor/MethodInvocationRecoverer.java
  84. +1 −1 src/main/java/org/springframework/{commons → }/retry/interceptor/NewMethodArgumentsIdentifier.java
  85. +5 −5 src/main/java/org/springframework/{commons → }/retry/interceptor/RetryOperationsInterceptor.java
  86. +10 −10 ...n/java/org/springframework/{commons → }/retry/interceptor/StatefulRetryOperationsInterceptor.java
  87. +7 −0 src/main/java/org/springframework/retry/interceptor/package.html
  88. +4 −4 src/main/java/org/springframework/{commons → }/retry/listener/RetryListenerSupport.java
  89. +7 −0 src/main/java/org/springframework/retry/listener/package.html
  90. +7 −0 src/main/java/org/springframework/retry/package.html
  91. +4 −4 src/main/java/org/springframework/{commons → }/retry/policy/AlwaysRetryPolicy.java
  92. +8 −8 src/main/java/org/springframework/{commons → }/retry/policy/CompositeRetryPolicy.java
  93. +11 −11 src/main/java/org/springframework/{commons → }/retry/policy/ExceptionClassifierRetryPolicy.java
  94. +2 −2 src/main/java/org/springframework/{commons → }/retry/policy/MapRetryContextCache.java
  95. +8 −8 src/main/java/org/springframework/{commons → }/retry/policy/NeverRetryPolicy.java
  96. +2 −2 src/main/java/org/springframework/{commons → }/retry/policy/RetryCacheCapacityExceededException.java
  97. +2 −2 src/main/java/org/springframework/{commons → }/retry/policy/RetryContextCache.java
  98. +8 −8 src/main/java/org/springframework/{commons → }/retry/policy/SimpleRetryPolicy.java
  99. +2 −2 src/main/java/org/springframework/{commons → }/retry/policy/SoftReferenceMapRetryContextCache.java
  100. +5 −5 src/main/java/org/springframework/{commons → }/retry/policy/TimeoutRetryPolicy.java
  101. +7 −0 src/main/java/org/springframework/retry/policy/package.html
  102. +9 −9 src/main/java/org/springframework/{commons → }/retry/support/DefaultRetryState.java
  103. +5 −5 src/main/java/org/springframework/{commons → }/retry/support/RetrySynchronizationManager.java
  104. +23 −21 src/main/java/org/springframework/{commons → }/retry/support/RetryTemplate.java
  105. +7 −0 src/main/java/org/springframework/retry/support/package.html
  106. +72 −0 src/test/java/org/springframework/classify/BackToBackPatternClassifierTests.java
  107. +62 −0 src/test/java/org/springframework/classify/BinaryExceptionClassifierTests.java
  108. +127 −0 src/test/java/org/springframework/classify/ClassifierAdapterTests.java
  109. +35 −0 src/test/java/org/springframework/classify/ClassifierSupportTests.java
  110. +58 −0 src/test/java/org/springframework/classify/PatternMatchingClassifierTests.java
  111. +85 −0 src/test/java/org/springframework/classify/SubclassExceptionClassifierTests.java
  112. +36 −0 src/test/java/org/springframework/repeat/AbstractExceptionTests.java
  113. +34 −0 src/test/java/org/springframework/repeat/RepeatExceptionTests.java
  114. +41 −0 src/test/java/org/springframework/repeat/callback/NestedRepeatCallbackTests.java
  115. +64 −0 src/test/java/org/springframework/repeat/context/RepeatContextCounterTests.java
  116. +93 −0 src/test/java/org/springframework/repeat/context/RepeatContextSupportTests.java
  117. +113 −0 src/test/java/org/springframework/repeat/context/SynchronizedAttributeAccessorTests.java
  118. +60 −0 src/test/java/org/springframework/repeat/exception/CompositeExceptionHandlerTests.java
  119. +45 −0 src/test/java/org/springframework/repeat/exception/DefaultExceptionHandlerTests.java
  120. +101 −0 src/test/java/org/springframework/repeat/exception/LogOrRethrowExceptionHandlerTests.java
  121. +116 −0 src/test/java/org/springframework/repeat/exception/RethrowOnThresholdExceptionHandlerTests.java
  122. +267 −0 src/test/java/org/springframework/repeat/exception/SimpleLimitExceptionHandlerTests.java
  123. +270 −0 src/test/java/org/springframework/repeat/interceptor/RepeatOperationsInterceptorTests.java
  124. +89 −0 src/test/java/org/springframework/repeat/listener/CompositeRepeatListenerTests.java
  125. +263 −0 src/test/java/org/springframework/repeat/listener/RepeatListenerTests.java
  126. +69 −0 src/test/java/org/springframework/repeat/policy/CompositeCompletionPolicyTests.java
  127. +138 −0 src/test/java/org/springframework/repeat/policy/CountingCompletionPolicyTests.java
  128. +27 −0 src/test/java/org/springframework/repeat/policy/MockCompletionPolicySupport.java
  129. +74 −0 src/test/java/org/springframework/repeat/policy/SimpleCompletionPolicyTests.java
  130. +63 −0 src/test/java/org/springframework/repeat/policy/TimeoutCompletionPolicyTests.java
  131. +73 −0 src/test/java/org/springframework/repeat/support/AbstractTradeBatchTests.java
  132. +210 −0 src/test/java/org/springframework/repeat/support/ChunkedRepeatTests.java
  133. +66 −0 src/test/java/org/springframework/repeat/support/RepeatSynchronizationManagerTests.java
  134. +61 −0 src/test/java/org/springframework/repeat/support/ResultHolderResultQueueTests.java
  135. +514 −0 src/test/java/org/springframework/repeat/support/SimpleRepeatTemplateTests.java
  136. +270 −0 src/test/java/org/springframework/repeat/support/TaskExecutorRepeatTemplateAsynchronousTests.java
  137. +201 −0 ...test/java/org/springframework/repeat/support/TaskExecutorRepeatTemplateBulkAsynchronousTests.java
  138. +43 −0 src/test/java/org/springframework/repeat/support/TaskExecutorRepeatTemplateTests.java
  139. +92 −0 src/test/java/org/springframework/repeat/support/ThrottleLimitResultQueueTests.java
  140. +53 −0 src/test/java/org/springframework/repeat/support/Trade.java
  141. +36 −0 src/test/java/org/springframework/retry/AbstractExceptionTests.java
  142. +34 −0 src/test/java/org/springframework/retry/BackOffInterruptedExceptionTests.java
  143. +34 −0 src/test/java/org/springframework/retry/ExhaustedRetryExceptionTests.java
  144. +80 −0 src/test/java/org/springframework/retry/ResourcelessTransactionManager.java
  145. +34 −0 src/test/java/org/springframework/retry/RetryExceptionTests.java
  146. +34 −0 src/test/java/org/springframework/retry/TerminatedRetryExceptionTests.java
  147. +58 −0 src/test/java/org/springframework/retry/backoff/DummySleeper.java
  148. +86 −0 src/test/java/org/springframework/retry/backoff/ExponentialBackOffPolicyTests.java
  149. +62 −0 src/test/java/org/springframework/retry/backoff/FixedBackOffPolicyTests.java
  150. +42 −0 src/test/java/org/springframework/retry/backoff/ObjectWaitSleeperTests.java
  151. +178 −0 src/test/java/org/springframework/retry/interceptor/RetryOperationsInterceptorTests.java
  152. +248 −0 src/test/java/org/springframework/retry/interceptor/StatefulRetryOperationsInterceptorTests.java
  153. +48 −0 src/test/java/org/springframework/retry/listener/RetryListenerSupportTests.java
  154. +162 −0 src/test/java/org/springframework/retry/listener/RetryListenerTests.java
  155. +54 −0 src/test/java/org/springframework/retry/policy/AlwaysRetryPolicyTests.java
  156. +138 −0 src/test/java/org/springframework/retry/policy/CompositeRetryPolicyTests.java
  157. +136 −0 src/test/java/org/springframework/retry/policy/ExceptionClassifierRetryPolicyTests.java
  158. +116 −0 src/test/java/org/springframework/retry/policy/FatalExceptionRetryPolicyTests.java
  159. +55 −0 src/test/java/org/springframework/retry/policy/MapRetryContextCacheTests.java
  160. +21 −0 src/test/java/org/springframework/retry/policy/MockRetryPolicySupport.java
  161. +57 −0 src/test/java/org/springframework/retry/policy/NeverRetryPolicyTests.java
  162. +110 −0 src/test/java/org/springframework/retry/policy/SimpleRetryPolicyTests.java
  163. +55 −0 src/test/java/org/springframework/retry/policy/SoftReferenceMapRetryContextCacheTests.java
  164. +133 −0 src/test/java/org/springframework/retry/policy/StatefulRetryIntegrationTests.java
  165. +55 −0 src/test/java/org/springframework/retry/policy/TimeoutRetryPolicyTests.java
  166. +87 −0 src/test/java/org/springframework/retry/support/DefaultRetryStateTests.java
  167. +93 −0 src/test/java/org/springframework/retry/support/RetrySynchronizationManagerTests.java
  168. +353 −0 src/test/java/org/springframework/retry/support/RetryTemplateTests.java
  169. +333 −0 src/test/java/org/springframework/retry/support/StatefulRecoveryRetryTests.java
  170. +5 −0 src/test/resources/org/springframework/repeat/support/trades.csv
  171. +35 −0 src/test/resources/org/springframework/retry/interceptor/retry-transaction-test.xml
View
26 pom.xml
@@ -75,6 +75,24 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <version>2.3</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.aspectj</groupId>
+ <artifactId>aspectjrt</artifactId>
+ <version>1.6.6</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.aspectj</groupId>
+ <artifactId>aspectjweaver</artifactId>
+ <version>1.6.6</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.framework.version}</version>
@@ -86,6 +104,12 @@
<version>${spring.framework.version}</version>
</dependency>
<dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-tx</artifactId>
+ <version>${spring.framework.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
@@ -128,7 +152,7 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <!--forkMode>pertest</forkMode-->
+ <!--forkMode>pertest</forkMode -->
<includes>
<include>**/*Tests.java</include>
</includes>
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2006-2007 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.classify;
+
+import java.util.Map;
+
+/**
+ * A special purpose {@link Classifier} with easy configuration options for
+ * mapping from one arbitrary type of object to another via a pattern matcher.
+ *
+ * @author Dave Syer
+ *
+ */
+public class BackToBackPatternClassifier<C, T> implements Classifier<C, T> {
+
+ private Classifier<C, String> router;
+
+ private Classifier<String, T> matcher;
+
+ /**
+ * Default constructor, provided as a convenience for people using setter
+ * injection.
+ */
+ public BackToBackPatternClassifier() {
+ }
+
+ /**
+ * Set up a classifier with input to the router and output from the matcher.
+ *
+ * @param router see {@link #setRouterDelegate(Object)}
+ * @param matcher see {@link #setMatcherMap(Map)}
+ */
+ public BackToBackPatternClassifier(Classifier<C, String> router, Classifier<String, T> matcher) {
+ super();
+ this.router = router;
+ this.matcher = matcher;
+ }
+
+ /**
+ * A convenience method for creating a pattern matching classifier for the
+ * matcher component.
+ *
+ * @param map maps pattern keys with wildcards to output values
+ */
+ public void setMatcherMap(Map<String, T> map) {
+ this.matcher = new PatternMatchingClassifier<T>(map);
+ }
+
+ /**
+ * A convenience method of creating a router classifier based on a plain old
+ * Java Object. The object provided must have precisely one public method
+ * that either has the @Classifier annotation or accepts a single argument
+ * and outputs a String. This will be used to create an input classifier for
+ * the router component. <br/>
+ *
+ * @param delegate the delegate object used to create a router classifier
+ */
+ public void setRouterDelegate(Object delegate) {
+ this.router = new ClassifierAdapter<C,String>(delegate);
+ }
+
+ /**
+ * Classify the input and map to a String, then take that and put it into a
+ * pattern matcher to match to an output value.
+ */
+ public T classify(C classifiable) {
+ return matcher.classify(router.classify(classifiable));
+ }
+
+}
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.commons.classify;
+package org.springframework.classify;
import java.util.Collection;
import java.util.HashMap;
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.springframework.commons.classify;
+package org.springframework.classify;
/**
* Interface for a classifier. At its simplest a {@link Classifier} is just a
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2006-2007 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.classify;
+
+import org.springframework.classify.util.MethodInvoker;
+import org.springframework.classify.util.MethodInvokerUtils;
+import org.springframework.util.Assert;
+
+/**
+ * Wrapper for an object to adapt it to the {@link Classifier} interface.
+ *
+ * @author Dave Syer
+ *
+ */
+public class ClassifierAdapter<C, T> implements Classifier<C, T> {
+
+ private MethodInvoker invoker;
+
+ private Classifier<C, T> classifier;
+
+ /**
+ * Default constructor for use with setter injection.
+ */
+ public ClassifierAdapter() {
+ super();
+ }
+
+ /**
+ * Create a new {@link Classifier} from the delegate provided. Use the
+ * constructor as an alternative to the {@link #setDelegate(Object)} method.
+ *
+ * @param delegate
+ */
+ public ClassifierAdapter(Object delegate) {
+ setDelegate(delegate);
+ }
+
+ /**
+ * Create a new {@link Classifier} from the delegate provided. Use the
+ * constructor as an alternative to the {@link #setDelegate(Classifier)}
+ * method.
+ *
+ * @param delegate
+ */
+ public ClassifierAdapter(Classifier<C, T> delegate) {
+ classifier = delegate;
+ }
+
+ public void setDelegate(Classifier<C, T> delegate) {
+ classifier = delegate;
+ invoker = null;
+ }
+
+ /**
+ * Search for the
+ * {@link org.springframework.classify.annotation.Classifier
+ * Classifier} annotation on a method in the supplied delegate and use that
+ * to create a {@link Classifier} from the parameter type to the return
+ * type. If the annotation is not found a unique non-void method with a
+ * single parameter will be used, if it exists. The signature of the method
+ * cannot be checked here, so might be a runtime exception when the method
+ * is invoked if the signature doesn't match the classifier types.
+ *
+ * @param delegate an object with an annotated method
+ */
+ public final void setDelegate(Object delegate) {
+ classifier = null;
+ invoker = MethodInvokerUtils.getMethodInvokerByAnnotation(
+ org.springframework.classify.annotation.Classifier.class, delegate);
+ if (invoker == null) {
+ invoker = MethodInvokerUtils.<C, T> getMethodInvokerForSingleArgument(delegate);
+ }
+ Assert.state(invoker != null, "No single argument public method with or without "
+ + "@Classifier was found in delegate of type " + delegate.getClass());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings("unchecked")
+ public T classify(C classifiable) {
+ if (classifier != null) {
+ return classifier.classify(classifiable);
+ }
+ return (T) invoker.invokeMethod(classifiable);
+ }
+
+}
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.springframework.commons.classify;
+package org.springframework.classify;
/**
* Base class for {@link Classifier} implementations. Provides default behaviour
@@ -39,7 +39,7 @@ public ClassifierSupport(T defaultValue) {
* Always returns the default value. This is the main extension point for
* subclasses, so it must be able to classify null.
*
- * @see org.springframework.commons.classify.Classifier#classify(Object)
+ * @see org.springframework.classify.Classifier#classify(Object)
*/
public T classify(C throwable) {
return defaultValue;
Oops, something went wrong.

0 comments on commit 9dd0346

Please sign in to comment.