diff --git a/spring-aop/src/main/java/org/springframework/aop/support/AbstractRegexpMethodPointcut.java b/spring-aop/src/main/java/org/springframework/aop/support/AbstractRegexpMethodPointcut.java index b7527ca6af6..fd712126d85 100644 --- a/spring-aop/src/main/java/org/springframework/aop/support/AbstractRegexpMethodPointcut.java +++ b/spring-aop/src/main/java/org/springframework/aop/support/AbstractRegexpMethodPointcut.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -29,17 +29,16 @@ import org.springframework.util.StringUtils; * * *

Note: the regular expressions must be a match. For example, * {@code .*get.*} will match com.mycom.Foo.getBar(). * {@code get.*} will not. * - *

This base class is serializable. Subclasses should declare all fields transient - * - the initPatternRepresentation method in this class will be invoked again on the - * client side on deserialization. + *

This base class is serializable. Subclasses should declare all fields transient; + * the {@link #initPatternRepresentation} method will be invoked again on deserialization. * * @author Rod Johnson * @author Juergen Hoeller @@ -51,10 +50,14 @@ import org.springframework.util.StringUtils; public abstract class AbstractRegexpMethodPointcut extends StaticMethodMatcherPointcut implements Serializable { - /** Regular expressions to match */ + /** + * Regular expressions to match. + */ private String[] patterns = new String[0]; - /** Regular expressions not to match */ + /** + * Regular expressions not to match. + */ private String[] excludedPatterns = new String[0]; @@ -64,15 +67,15 @@ public abstract class AbstractRegexpMethodPointcut extends StaticMethodMatcherPo * @see #setPatterns */ public void setPattern(String pattern) { - setPatterns(new String[] {pattern}); + setPatterns(pattern); } /** * Set the regular expressions defining methods to match. - * Matching will be the union of all these; if any match, - * the pointcut matches. + * Matching will be the union of all these; if any match, the pointcut matches. + * @see #setPattern */ - public void setPatterns(String[] patterns) { + public void setPatterns(String... patterns) { Assert.notEmpty(patterns, "'patterns' must not be empty"); this.patterns = new String[patterns.length]; for (int i = 0; i < patterns.length; i++) { @@ -94,15 +97,15 @@ public abstract class AbstractRegexpMethodPointcut extends StaticMethodMatcherPo * @see #setExcludedPatterns */ public void setExcludedPattern(String excludedPattern) { - setExcludedPatterns(new String[] {excludedPattern}); + setExcludedPatterns(excludedPattern); } /** * Set the regular expressions defining methods to match for exclusion. - * Matching will be the union of all these; if any match, - * the pointcut matches. + * Matching will be the union of all these; if any match, the pointcut matches. + * @see #setExcludedPattern */ - public void setExcludedPatterns(String[] excludedPatterns) { + public void setExcludedPatterns(String... excludedPatterns) { Assert.notEmpty(excludedPatterns, "'excludedPatterns' must not be empty"); this.excludedPatterns = new String[excludedPatterns.length]; for (int i = 0; i < excludedPatterns.length; i++) { @@ -124,7 +127,7 @@ public abstract class AbstractRegexpMethodPointcut extends StaticMethodMatcherPo * of the target class as well as against the method's declaring class, * plus the name of the method. */ - public boolean matches(Method method, Class targetClass) { + public boolean matches(Method method, Class targetClass) { return ((targetClass != null && matchesPattern(targetClass.getName() + "." + method.getName())) || matchesPattern(method.getDeclaringClass().getName() + "." + method.getName())); } @@ -172,18 +175,18 @@ public abstract class AbstractRegexpMethodPointcut extends StaticMethodMatcherPo protected abstract void initExcludedPatternRepresentation(String[] patterns) throws IllegalArgumentException; /** - * Does the pattern at the given index match this string? - * @param pattern {@code String} pattern to match - * @param patternIndex index of pattern from 0 - * @return {@code true} if there is a match, else {@code false}. + * Does the pattern at the given index match the given String? + * @param pattern the {@code String} pattern to match + * @param patternIndex index of pattern (starting from 0) + * @return {@code true} if there is a match, {@code false} otherwise */ protected abstract boolean matches(String pattern, int patternIndex); /** - * Does the exclusion pattern at the given index match this string? - * @param pattern {@code String} pattern to match. - * @param patternIndex index of pattern starting from 0. - * @return {@code true} if there is a match, else {@code false}. + * Does the exclusion pattern at the given index match the given String? + * @param pattern the {@code String} pattern to match + * @param patternIndex index of pattern (starting from 0) + * @return {@code true} if there is a match, {@code false} otherwise */ protected abstract boolean matchesExclusion(String pattern, int patternIndex); diff --git a/spring-aop/src/main/java/org/springframework/aop/support/ComposablePointcut.java b/spring-aop/src/main/java/org/springframework/aop/support/ComposablePointcut.java index b537a6ab8e5..42ae067dcfb 100644 --- a/spring-aop/src/main/java/org/springframework/aop/support/ComposablePointcut.java +++ b/spring-aop/src/main/java/org/springframework/aop/support/ComposablePointcut.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -178,7 +178,6 @@ public class ComposablePointcut implements Pointcut, Serializable { return this.methodMatcher; } - @Override public boolean equals(Object other) { if (this == other) { @@ -187,7 +186,6 @@ public class ComposablePointcut implements Pointcut, Serializable { if (!(other instanceof ComposablePointcut)) { return false; } - ComposablePointcut that = (ComposablePointcut) other; return ObjectUtils.nullSafeEquals(that.classFilter, this.classFilter) && ObjectUtils.nullSafeEquals(that.methodMatcher, this.methodMatcher); @@ -207,8 +205,7 @@ public class ComposablePointcut implements Pointcut, Serializable { @Override public String toString() { - return "ComposablePointcut: ClassFilter [" + this.classFilter + - "], MethodMatcher [" + this.methodMatcher + "]"; + return "ComposablePointcut: " + this.classFilter + ", " +this.methodMatcher; } } diff --git a/spring-web/src/main/java/org/springframework/http/converter/json/Jackson2ObjectMapperFactoryBean.java b/spring-web/src/main/java/org/springframework/http/converter/json/Jackson2ObjectMapperFactoryBean.java index ae42d5f090d..2b96585b9cf 100644 --- a/spring-web/src/main/java/org/springframework/http/converter/json/Jackson2ObjectMapperFactoryBean.java +++ b/spring-web/src/main/java/org/springframework/http/converter/json/Jackson2ObjectMapperFactoryBean.java @@ -45,7 +45,7 @@ import org.springframework.util.Assert; *

Example usage with * {@link org.springframework.http.converter.json.MappingJackson2HttpMessageConverter}: * - *

+ * 
  * <bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
  *   <property name="objectMapper">
  *     <bean class="org.springframework.web.context.support.Jackson2ObjectMapperFactoryBean"
@@ -58,7 +58,7 @@ import org.springframework.util.Assert;
  *
  * 

Example usage with MappingJackson2JsonView: * - *

+ * 
  * <bean class="org.springframework.web.servlet.view.json.MappingJackson2JsonView">
  *   <property name="objectMapper">
  *     <bean class="org.springframework.web.context.support.Jackson2ObjectMapperFactoryBean"
@@ -78,7 +78,7 @@ import org.springframework.util.Assert;
  * options), you can still use the more general methods
  * {@link #setFeaturesToEnable(Object[])} and {@link #setFeaturesToDisable(Object[])}.
  *
- * 
+ * 
  * <bean class="org.springframework.web.context.support.Jackson2ObjectMapperFactoryBean">
  *   <property name="featuresToEnable">
  *     <array>
@@ -102,8 +102,6 @@ public class Jackson2ObjectMapperFactoryBean implements FactoryBean features = new HashMap();
-
 	private DateFormat dateFormat;
 
 	private AnnotationIntrospector annotationIntrospector;
@@ -112,6 +110,8 @@ public class Jackson2ObjectMapperFactoryBean implements FactoryBean, JsonDeserializer> deserializers = new LinkedHashMap, JsonDeserializer>();
 
+	private final Map features = new HashMap();
+
 
 	/**
 	 * Set the ObjectMapper instance to use. If not set, the ObjectMapper will
@@ -142,8 +142,7 @@ public class Jackson2ObjectMapperFactoryBean implements FactoryBean