Backport selected refinements from the nullability efforts
Issue: SPR-15656
This commit is contained in:
parent
18a3322d2f
commit
9fdc4404a5
|
|
@ -1,5 +1,5 @@
|
||||||
/*<
|
/*<
|
||||||
* Copyright 2002-2012 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -34,9 +34,8 @@ public interface TargetSource extends TargetClassAware {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the type of targets returned by this {@link TargetSource}.
|
* Return the type of targets returned by this {@link TargetSource}.
|
||||||
* <p>Can return {@code null}, although certain usages of a
|
* <p>Can return {@code null}, although certain usages of a {@code TargetSource}
|
||||||
* {@code TargetSource} might just work with a predetermined
|
* might just work with a predetermined target class.
|
||||||
* target class.
|
|
||||||
* @return the type of targets returned by this {@link TargetSource}
|
* @return the type of targets returned by this {@link TargetSource}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -44,9 +43,8 @@ public interface TargetSource extends TargetClassAware {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will all calls to {@link #getTarget()} return the same object?
|
* Will all calls to {@link #getTarget()} return the same object?
|
||||||
* <p>In that case, there will be no need to invoke
|
* <p>In that case, there will be no need to invoke {@link #releaseTarget(Object)},
|
||||||
* {@link #releaseTarget(Object)}, and the AOP framework can cache
|
* and the AOP framework can cache the return value of {@link #getTarget()}.
|
||||||
* the return value of {@link #getTarget()}.
|
|
||||||
* @return {@code true} if the target is immutable
|
* @return {@code true} if the target is immutable
|
||||||
* @see #getTarget
|
* @see #getTarget
|
||||||
*/
|
*/
|
||||||
|
|
@ -55,14 +53,15 @@ public interface TargetSource extends TargetClassAware {
|
||||||
/**
|
/**
|
||||||
* Return a target instance. Invoked immediately before the
|
* Return a target instance. Invoked immediately before the
|
||||||
* AOP framework calls the "target" of an AOP method invocation.
|
* AOP framework calls the "target" of an AOP method invocation.
|
||||||
* @return the target object, which contains the joinpoint
|
* @return the target object which contains the joinpoint,
|
||||||
|
* or {@code null} if there is no actual target instance
|
||||||
* @throws Exception if the target object can't be resolved
|
* @throws Exception if the target object can't be resolved
|
||||||
*/
|
*/
|
||||||
Object getTarget() throws Exception;
|
Object getTarget() throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Release the given target object obtained from the
|
* Release the given target object obtained from the
|
||||||
* {@link #getTarget()} method.
|
* {@link #getTarget()} method, if any.
|
||||||
* @param target object obtained from a call to {@link #getTarget()}
|
* @param target object obtained from a call to {@link #getTarget()}
|
||||||
* @throws Exception if the object can't be released
|
* @throws Exception if the object can't be released
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2015 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -103,8 +103,8 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
|
||||||
private final AspectInstanceFactory aspectInstanceFactory;
|
private final AspectInstanceFactory aspectInstanceFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The name of the aspect (ref bean) in which this advice was defined (used
|
* The name of the aspect (ref bean) in which this advice was defined
|
||||||
* when determining advice precedence so that we can determine
|
* (used when determining advice precedence so that we can determine
|
||||||
* whether two pieces of advice come from the same aspect).
|
* whether two pieces of advice come from the same aspect).
|
||||||
*/
|
*/
|
||||||
private String aspectName;
|
private String aspectName;
|
||||||
|
|
@ -118,13 +118,13 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
|
||||||
* This will be non-null if the creator of this advice object knows the argument names
|
* This will be non-null if the creator of this advice object knows the argument names
|
||||||
* and sets them explicitly
|
* and sets them explicitly
|
||||||
*/
|
*/
|
||||||
private String[] argumentNames = null;
|
private String[] argumentNames;
|
||||||
|
|
||||||
/** Non-null if after throwing advice binds the thrown value */
|
/** Non-null if after throwing advice binds the thrown value */
|
||||||
private String throwingName = null;
|
private String throwingName;
|
||||||
|
|
||||||
/** Non-null if after returning advice binds the return value */
|
/** Non-null if after returning advice binds the return value */
|
||||||
private String returningName = null;
|
private String returningName;
|
||||||
|
|
||||||
private Class<?> discoveredReturningType = Object.class;
|
private Class<?> discoveredReturningType = Object.class;
|
||||||
|
|
||||||
|
|
@ -295,8 +295,8 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
|
||||||
}
|
}
|
||||||
catch (Throwable ex) {
|
catch (Throwable ex) {
|
||||||
throw new IllegalArgumentException("Returning name '" + name +
|
throw new IllegalArgumentException("Returning name '" + name +
|
||||||
"' is neither a valid argument name nor the fully-qualified name of a Java type on the classpath. " +
|
"' is neither a valid argument name nor the fully-qualified " +
|
||||||
"Root cause: " + ex);
|
"name of a Java type on the classpath. Root cause: " + ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -329,8 +329,8 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
|
||||||
}
|
}
|
||||||
catch (Throwable ex) {
|
catch (Throwable ex) {
|
||||||
throw new IllegalArgumentException("Throwing name '" + name +
|
throw new IllegalArgumentException("Throwing name '" + name +
|
||||||
"' is neither a valid argument name nor the fully-qualified name of a Java type on the classpath. " +
|
"' is neither a valid argument name nor the fully-qualified " +
|
||||||
"Root cause: " + ex);
|
"name of a Java type on the classpath. Root cause: " + ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2012 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -113,6 +113,7 @@ import org.springframework.util.StringUtils;
|
||||||
* returning {@code null} in the case that the parameter names cannot be discovered.
|
* returning {@code null} in the case that the parameter names cannot be discovered.
|
||||||
*
|
*
|
||||||
* @author Adrian Colyer
|
* @author Adrian Colyer
|
||||||
|
* @author Juergen Hoeller
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscoverer {
|
public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscoverer {
|
||||||
|
|
@ -154,23 +155,17 @@ public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscov
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** The pointcut expression associated with the advice, as a simple String */
|
||||||
|
private String pointcutExpression;
|
||||||
|
|
||||||
private boolean raiseExceptions;
|
private boolean raiseExceptions;
|
||||||
|
|
||||||
/**
|
/** If the advice is afterReturning, and binds the return value, this is the parameter name used */
|
||||||
* If the advice is afterReturning, and binds the return value, this is the parameter name used.
|
|
||||||
*/
|
|
||||||
private String returningName;
|
private String returningName;
|
||||||
|
|
||||||
/**
|
/** If the advice is afterThrowing, and binds the thrown value, this is the parameter name used */
|
||||||
* If the advice is afterThrowing, and binds the thrown value, this is the parameter name used.
|
|
||||||
*/
|
|
||||||
private String throwingName;
|
private String throwingName;
|
||||||
|
|
||||||
/**
|
|
||||||
* The pointcut expression associated with the advice, as a simple String.
|
|
||||||
*/
|
|
||||||
private String pointcutExpression;
|
|
||||||
|
|
||||||
private Class<?>[] argumentTypes;
|
private Class<?>[] argumentTypes;
|
||||||
|
|
||||||
private String[] parameterNameBindings;
|
private String[] parameterNameBindings;
|
||||||
|
|
@ -186,6 +181,7 @@ public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscov
|
||||||
this.pointcutExpression = pointcutExpression;
|
this.pointcutExpression = pointcutExpression;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicate whether {@link IllegalArgumentException} and {@link AmbiguousBindingException}
|
* Indicate whether {@link IllegalArgumentException} and {@link AmbiguousBindingException}
|
||||||
* must be thrown as appropriate in the case of failing to deduce advice parameter names.
|
* must be thrown as appropriate in the case of failing to deduce advice parameter names.
|
||||||
|
|
@ -213,6 +209,7 @@ public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscov
|
||||||
this.throwingName = throwingName;
|
this.throwingName = throwingName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deduce the parameter names for an advice method.
|
* Deduce the parameter names for an advice method.
|
||||||
* <p>See the {@link AspectJAdviceParameterNameDiscoverer class level javadoc}
|
* <p>See the {@link AspectJAdviceParameterNameDiscoverer class level javadoc}
|
||||||
|
|
@ -474,7 +471,7 @@ public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscov
|
||||||
* If the token starts meets Java identifier conventions, it's in.
|
* If the token starts meets Java identifier conventions, it's in.
|
||||||
*/
|
*/
|
||||||
private String maybeExtractVariableName(String candidateToken) {
|
private String maybeExtractVariableName(String candidateToken) {
|
||||||
if (candidateToken == null || candidateToken.equals("")) {
|
if (!StringUtils.hasLength(candidateToken)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (Character.isJavaIdentifierStart(candidateToken.charAt(0)) &&
|
if (Character.isJavaIdentifierStart(candidateToken.charAt(0)) &&
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -454,10 +454,7 @@ public abstract class AbstractAutoProxyCreator extends ProxyProcessorSupport
|
||||||
}
|
}
|
||||||
|
|
||||||
Advisor[] advisors = buildAdvisors(beanName, specificInterceptors);
|
Advisor[] advisors = buildAdvisors(beanName, specificInterceptors);
|
||||||
for (Advisor advisor : advisors) {
|
proxyFactory.addAdvisors(advisors);
|
||||||
proxyFactory.addAdvisor(advisor);
|
|
||||||
}
|
|
||||||
|
|
||||||
proxyFactory.setTargetSource(targetSource);
|
proxyFactory.setTargetSource(targetSource);
|
||||||
customizeProxyFactory(proxyFactory);
|
customizeProxyFactory(proxyFactory);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2013 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -22,7 +22,6 @@ import org.springframework.aop.ClassFilter;
|
||||||
import org.springframework.aop.MethodMatcher;
|
import org.springframework.aop.MethodMatcher;
|
||||||
import org.springframework.aop.Pointcut;
|
import org.springframework.aop.Pointcut;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
import org.springframework.util.ObjectUtils;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convenient class for building up pointcuts. All methods return
|
* Convenient class for building up pointcuts. All methods return
|
||||||
|
|
@ -188,21 +187,14 @@ public class ComposablePointcut implements Pointcut, Serializable {
|
||||||
if (!(other instanceof ComposablePointcut)) {
|
if (!(other instanceof ComposablePointcut)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ComposablePointcut that = (ComposablePointcut) other;
|
ComposablePointcut otherPointcut = (ComposablePointcut) other;
|
||||||
return ObjectUtils.nullSafeEquals(that.classFilter, this.classFilter) &&
|
return (this.classFilter.equals(otherPointcut.classFilter) &&
|
||||||
ObjectUtils.nullSafeEquals(that.methodMatcher, this.methodMatcher);
|
this.methodMatcher.equals(otherPointcut.methodMatcher));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int code = 17;
|
return this.classFilter.hashCode() * 37 + this.methodMatcher.hashCode();
|
||||||
if (this.classFilter != null) {
|
|
||||||
code = 37 * code + this.classFilter.hashCode();
|
|
||||||
}
|
|
||||||
if (this.methodMatcher != null) {
|
|
||||||
code = 37 * code + this.methodMatcher.hashCode();
|
|
||||||
}
|
|
||||||
return code;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2014 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2013 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -22,7 +22,6 @@ import org.springframework.aop.ClassFilter;
|
||||||
import org.springframework.aop.MethodMatcher;
|
import org.springframework.aop.MethodMatcher;
|
||||||
import org.springframework.aop.Pointcut;
|
import org.springframework.aop.Pointcut;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
import org.springframework.util.ObjectUtils;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simple Pointcut that looks for a specific Java 5 annotation
|
* Simple Pointcut that looks for a specific Java 5 annotation
|
||||||
|
|
@ -46,16 +45,15 @@ public class AnnotationMatchingPointcut implements Pointcut {
|
||||||
* @param classAnnotationType the annotation type to look for at the class level
|
* @param classAnnotationType the annotation type to look for at the class level
|
||||||
*/
|
*/
|
||||||
public AnnotationMatchingPointcut(Class<? extends Annotation> classAnnotationType) {
|
public AnnotationMatchingPointcut(Class<? extends Annotation> classAnnotationType) {
|
||||||
this.classFilter = new AnnotationClassFilter(classAnnotationType);
|
this(classAnnotationType, false);
|
||||||
this.methodMatcher = MethodMatcher.TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new AnnotationMatchingPointcut for the given annotation type.
|
* Create a new AnnotationMatchingPointcut for the given annotation type.
|
||||||
* @param classAnnotationType the annotation type to look for at the class level
|
* @param classAnnotationType the annotation type to look for at the class level
|
||||||
* @param checkInherited whether to explicitly check the superclasses and
|
* @param checkInherited whether to also check the superclasses and interfaces
|
||||||
* interfaces for the annotation type as well (even if the annotation type
|
* as well as meta-annotations for the annotation type
|
||||||
* is not marked as inherited itself)
|
* @see AnnotationClassFilter#AnnotationClassFilter(Class, boolean)
|
||||||
*/
|
*/
|
||||||
public AnnotationMatchingPointcut(Class<? extends Annotation> classAnnotationType, boolean checkInherited) {
|
public AnnotationMatchingPointcut(Class<? extends Annotation> classAnnotationType, boolean checkInherited) {
|
||||||
this.classFilter = new AnnotationClassFilter(classAnnotationType, checkInherited);
|
this.classFilter = new AnnotationClassFilter(classAnnotationType, checkInherited);
|
||||||
|
|
@ -109,21 +107,14 @@ public class AnnotationMatchingPointcut implements Pointcut {
|
||||||
if (!(other instanceof AnnotationMatchingPointcut)) {
|
if (!(other instanceof AnnotationMatchingPointcut)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
AnnotationMatchingPointcut that = (AnnotationMatchingPointcut) other;
|
AnnotationMatchingPointcut otherPointcut = (AnnotationMatchingPointcut) other;
|
||||||
return ObjectUtils.nullSafeEquals(that.classFilter, this.classFilter) &&
|
return (this.classFilter.equals(otherPointcut.classFilter) &&
|
||||||
ObjectUtils.nullSafeEquals(that.methodMatcher, this.methodMatcher);
|
this.methodMatcher.equals(otherPointcut.methodMatcher));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int code = 17;
|
return this.classFilter.hashCode() * 37 + this.methodMatcher.hashCode();
|
||||||
if (this.classFilter != null) {
|
|
||||||
code = 37 * code + this.classFilter.hashCode();
|
|
||||||
}
|
|
||||||
if (this.methodMatcher != null) {
|
|
||||||
code = 37 * code + this.methodMatcher.hashCode();
|
|
||||||
}
|
|
||||||
return code;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -81,8 +81,6 @@ public interface PropertyAccessor {
|
||||||
* (may be a nested path and/or an indexed/mapped property)
|
* (may be a nested path and/or an indexed/mapped property)
|
||||||
* @return the property type for the particular property,
|
* @return the property type for the particular property,
|
||||||
* or {@code null} if not determinable
|
* or {@code null} if not determinable
|
||||||
* @throws InvalidPropertyException if there is no such property or
|
|
||||||
* if the property isn't readable
|
|
||||||
* @throws PropertyAccessException if the property was valid but the
|
* @throws PropertyAccessException if the property was valid but the
|
||||||
* accessor method failed
|
* accessor method failed
|
||||||
*/
|
*/
|
||||||
|
|
@ -95,8 +93,8 @@ public interface PropertyAccessor {
|
||||||
* (may be a nested path and/or an indexed/mapped property)
|
* (may be a nested path and/or an indexed/mapped property)
|
||||||
* @return the property type for the particular property,
|
* @return the property type for the particular property,
|
||||||
* or {@code null} if not determinable
|
* or {@code null} if not determinable
|
||||||
* @throws InvalidPropertyException if there is no such property or
|
* @throws PropertyAccessException if the property was valid but the
|
||||||
* if the property isn't readable
|
* accessor method failed
|
||||||
*/
|
*/
|
||||||
TypeDescriptor getPropertyTypeDescriptor(String propertyName) throws BeansException;
|
TypeDescriptor getPropertyTypeDescriptor(String propertyName) throws BeansException;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -158,6 +158,22 @@ public interface BeanFactory {
|
||||||
*/
|
*/
|
||||||
<T> T getBean(String name, Class<T> requiredType) throws BeansException;
|
<T> T getBean(String name, Class<T> requiredType) throws BeansException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return an instance, which may be shared or independent, of the specified bean.
|
||||||
|
* <p>Allows for specifying explicit constructor arguments / factory method arguments,
|
||||||
|
* overriding the specified default arguments (if any) in the bean definition.
|
||||||
|
* @param name the name of the bean to retrieve
|
||||||
|
* @param args arguments to use when creating a bean instance using explicit arguments
|
||||||
|
* (only applied when creating a new instance as opposed to retrieving an existing one)
|
||||||
|
* @return an instance of the bean
|
||||||
|
* @throws NoSuchBeanDefinitionException if there is no such bean definition
|
||||||
|
* @throws BeanDefinitionStoreException if arguments have been given but
|
||||||
|
* the affected bean isn't a prototype
|
||||||
|
* @throws BeansException if the bean could not be created
|
||||||
|
* @since 2.5
|
||||||
|
*/
|
||||||
|
Object getBean(String name, Object... args) throws BeansException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the bean instance that uniquely matches the given object type, if any.
|
* Return the bean instance that uniquely matches the given object type, if any.
|
||||||
* <p>This method goes into {@link ListableBeanFactory} by-type lookup territory
|
* <p>This method goes into {@link ListableBeanFactory} by-type lookup territory
|
||||||
|
|
@ -175,22 +191,6 @@ public interface BeanFactory {
|
||||||
*/
|
*/
|
||||||
<T> T getBean(Class<T> requiredType) throws BeansException;
|
<T> T getBean(Class<T> requiredType) throws BeansException;
|
||||||
|
|
||||||
/**
|
|
||||||
* Return an instance, which may be shared or independent, of the specified bean.
|
|
||||||
* <p>Allows for specifying explicit constructor arguments / factory method arguments,
|
|
||||||
* overriding the specified default arguments (if any) in the bean definition.
|
|
||||||
* @param name the name of the bean to retrieve
|
|
||||||
* @param args arguments to use when creating a bean instance using explicit arguments
|
|
||||||
* (only applied when creating a new instance as opposed to retrieving an existing one)
|
|
||||||
* @return an instance of the bean
|
|
||||||
* @throws NoSuchBeanDefinitionException if there is no such bean definition
|
|
||||||
* @throws BeanDefinitionStoreException if arguments have been given but
|
|
||||||
* the affected bean isn't a prototype
|
|
||||||
* @throws BeansException if the bean could not be created
|
|
||||||
* @since 2.5
|
|
||||||
*/
|
|
||||||
Object getBean(String name, Object... args) throws BeansException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return an instance, which may be shared or independent, of the specified bean.
|
* Return an instance, which may be shared or independent, of the specified bean.
|
||||||
* <p>Allows for specifying explicit constructor arguments / factory method arguments,
|
* <p>Allows for specifying explicit constructor arguments / factory method arguments,
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2015 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -281,15 +281,15 @@ public class ServiceLocatorFactoryBean implements FactoryBean<Object>, BeanFacto
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
protected Constructor<Exception> determineServiceLocatorExceptionConstructor(Class<? extends Exception> exceptionClass) {
|
protected Constructor<Exception> determineServiceLocatorExceptionConstructor(Class<? extends Exception> exceptionClass) {
|
||||||
try {
|
try {
|
||||||
return (Constructor<Exception>) exceptionClass.getConstructor(new Class<?>[] {String.class, Throwable.class});
|
return (Constructor<Exception>) exceptionClass.getConstructor(String.class, Throwable.class);
|
||||||
}
|
}
|
||||||
catch (NoSuchMethodException ex) {
|
catch (NoSuchMethodException ex) {
|
||||||
try {
|
try {
|
||||||
return (Constructor<Exception>) exceptionClass.getConstructor(new Class<?>[] {Throwable.class});
|
return (Constructor<Exception>) exceptionClass.getConstructor(Throwable.class);
|
||||||
}
|
}
|
||||||
catch (NoSuchMethodException ex2) {
|
catch (NoSuchMethodException ex2) {
|
||||||
try {
|
try {
|
||||||
return (Constructor<Exception>) exceptionClass.getConstructor(new Class<?>[] {String.class});
|
return (Constructor<Exception>) exceptionClass.getConstructor(String.class);
|
||||||
}
|
}
|
||||||
catch (NoSuchMethodException ex3) {
|
catch (NoSuchMethodException ex3) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
|
|
@ -357,7 +357,7 @@ public class ServiceLocatorFactoryBean implements FactoryBean<Object>, BeanFacto
|
||||||
return System.identityHashCode(proxy);
|
return System.identityHashCode(proxy);
|
||||||
}
|
}
|
||||||
else if (ReflectionUtils.isToStringMethod(method)) {
|
else if (ReflectionUtils.isToStringMethod(method)) {
|
||||||
return "Service locator: " + serviceLocatorInterface.getName();
|
return "Service locator: " + serviceLocatorInterface;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return invokeServiceLocatorMethod(method, args);
|
return invokeServiceLocatorMethod(method, args);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2007 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -37,6 +37,13 @@ public class ReaderContext {
|
||||||
private final SourceExtractor sourceExtractor;
|
private final SourceExtractor sourceExtractor;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct a new {@code ReaderContext}.
|
||||||
|
* @param resource the XML bean definition resource
|
||||||
|
* @param problemReporter the problem reporter in use
|
||||||
|
* @param eventListener the event listener in use
|
||||||
|
* @param sourceExtractor the source extractor in use
|
||||||
|
*/
|
||||||
public ReaderContext(Resource resource, ProblemReporter problemReporter,
|
public ReaderContext(Resource resource, ProblemReporter problemReporter,
|
||||||
ReaderEventListener eventListener, SourceExtractor sourceExtractor) {
|
ReaderEventListener eventListener, SourceExtractor sourceExtractor) {
|
||||||
|
|
||||||
|
|
@ -51,83 +58,150 @@ public class ReaderContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Errors and warnings
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Raise a fatal error.
|
||||||
|
*/
|
||||||
public void fatal(String message, Object source) {
|
public void fatal(String message, Object source) {
|
||||||
fatal(message, source, null, null);
|
fatal(message, source, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Raise a fatal error.
|
||||||
|
*/
|
||||||
public void fatal(String message, Object source, Throwable ex) {
|
public void fatal(String message, Object source, Throwable ex) {
|
||||||
fatal(message, source, null, ex);
|
fatal(message, source, null, ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Raise a fatal error.
|
||||||
|
*/
|
||||||
public void fatal(String message, Object source, ParseState parseState) {
|
public void fatal(String message, Object source, ParseState parseState) {
|
||||||
fatal(message, source, parseState, null);
|
fatal(message, source, parseState, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Raise a fatal error.
|
||||||
|
*/
|
||||||
public void fatal(String message, Object source, ParseState parseState, Throwable cause) {
|
public void fatal(String message, Object source, ParseState parseState, Throwable cause) {
|
||||||
Location location = new Location(getResource(), source);
|
Location location = new Location(getResource(), source);
|
||||||
this.problemReporter.fatal(new Problem(message, location, parseState, cause));
|
this.problemReporter.fatal(new Problem(message, location, parseState, cause));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Raise a regular error.
|
||||||
|
*/
|
||||||
public void error(String message, Object source) {
|
public void error(String message, Object source) {
|
||||||
error(message, source, null, null);
|
error(message, source, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Raise a regular error.
|
||||||
|
*/
|
||||||
public void error(String message, Object source, Throwable ex) {
|
public void error(String message, Object source, Throwable ex) {
|
||||||
error(message, source, null, ex);
|
error(message, source, null, ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Raise a regular error.
|
||||||
|
*/
|
||||||
public void error(String message, Object source, ParseState parseState) {
|
public void error(String message, Object source, ParseState parseState) {
|
||||||
error(message, source, parseState, null);
|
error(message, source, parseState, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Raise a regular error.
|
||||||
|
*/
|
||||||
public void error(String message, Object source, ParseState parseState, Throwable cause) {
|
public void error(String message, Object source, ParseState parseState, Throwable cause) {
|
||||||
Location location = new Location(getResource(), source);
|
Location location = new Location(getResource(), source);
|
||||||
this.problemReporter.error(new Problem(message, location, parseState, cause));
|
this.problemReporter.error(new Problem(message, location, parseState, cause));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Raise a non-critical warning.
|
||||||
|
*/
|
||||||
public void warning(String message, Object source) {
|
public void warning(String message, Object source) {
|
||||||
warning(message, source, null, null);
|
warning(message, source, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Raise a non-critical warning.
|
||||||
|
*/
|
||||||
public void warning(String message, Object source, Throwable ex) {
|
public void warning(String message, Object source, Throwable ex) {
|
||||||
warning(message, source, null, ex);
|
warning(message, source, null, ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Raise a non-critical warning.
|
||||||
|
*/
|
||||||
public void warning(String message, Object source, ParseState parseState) {
|
public void warning(String message, Object source, ParseState parseState) {
|
||||||
warning(message, source, parseState, null);
|
warning(message, source, parseState, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Raise a non-critical warning.
|
||||||
|
*/
|
||||||
public void warning(String message, Object source, ParseState parseState, Throwable cause) {
|
public void warning(String message, Object source, ParseState parseState, Throwable cause) {
|
||||||
Location location = new Location(getResource(), source);
|
Location location = new Location(getResource(), source);
|
||||||
this.problemReporter.warning(new Problem(message, location, parseState, cause));
|
this.problemReporter.warning(new Problem(message, location, parseState, cause));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Explicit parse events
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fire an defaults-registered event.
|
||||||
|
*/
|
||||||
public void fireDefaultsRegistered(DefaultsDefinition defaultsDefinition) {
|
public void fireDefaultsRegistered(DefaultsDefinition defaultsDefinition) {
|
||||||
this.eventListener.defaultsRegistered(defaultsDefinition);
|
this.eventListener.defaultsRegistered(defaultsDefinition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fire an component-registered event.
|
||||||
|
*/
|
||||||
public void fireComponentRegistered(ComponentDefinition componentDefinition) {
|
public void fireComponentRegistered(ComponentDefinition componentDefinition) {
|
||||||
this.eventListener.componentRegistered(componentDefinition);
|
this.eventListener.componentRegistered(componentDefinition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fire an alias-registered event.
|
||||||
|
*/
|
||||||
public void fireAliasRegistered(String beanName, String alias, Object source) {
|
public void fireAliasRegistered(String beanName, String alias, Object source) {
|
||||||
this.eventListener.aliasRegistered(new AliasDefinition(beanName, alias, source));
|
this.eventListener.aliasRegistered(new AliasDefinition(beanName, alias, source));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fire an import-processed event.
|
||||||
|
*/
|
||||||
public void fireImportProcessed(String importedResource, Object source) {
|
public void fireImportProcessed(String importedResource, Object source) {
|
||||||
this.eventListener.importProcessed(new ImportDefinition(importedResource, source));
|
this.eventListener.importProcessed(new ImportDefinition(importedResource, source));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fire an import-processed event.
|
||||||
|
*/
|
||||||
public void fireImportProcessed(String importedResource, Resource[] actualResources, Object source) {
|
public void fireImportProcessed(String importedResource, Resource[] actualResources, Object source) {
|
||||||
this.eventListener.importProcessed(new ImportDefinition(importedResource, actualResources, source));
|
this.eventListener.importProcessed(new ImportDefinition(importedResource, actualResources, source));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Source extraction
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the source extractor in use.
|
||||||
|
*/
|
||||||
public SourceExtractor getSourceExtractor() {
|
public SourceExtractor getSourceExtractor() {
|
||||||
return this.sourceExtractor;
|
return this.sourceExtractor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Call the source extractor for the given source object.
|
||||||
|
* @param sourceCandidate the original source object
|
||||||
|
* @return the source object to store, or {@code null} for none.
|
||||||
|
* @see #getSourceExtractor()
|
||||||
|
* @see SourceExtractor#extractSource
|
||||||
|
*/
|
||||||
public Object extractSource(Object sourceCandidate) {
|
public Object extractSource(Object sourceCandidate) {
|
||||||
return this.sourceExtractor.extractSource(sourceCandidate, this.resource);
|
return this.sourceExtractor.extractSource(sourceCandidate, this.resource);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2012 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -62,7 +62,7 @@ public class BeanDefinitionDefaults {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setInitMethodName(String initMethodName) {
|
public void setInitMethodName(String initMethodName) {
|
||||||
this.initMethodName = (StringUtils.hasText(initMethodName)) ? initMethodName : null;
|
this.initMethodName = (StringUtils.hasText(initMethodName) ? initMethodName : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getInitMethodName() {
|
public String getInitMethodName() {
|
||||||
|
|
@ -70,7 +70,7 @@ public class BeanDefinitionDefaults {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDestroyMethodName(String destroyMethodName) {
|
public void setDestroyMethodName(String destroyMethodName) {
|
||||||
this.destroyMethodName = (StringUtils.hasText(destroyMethodName)) ? destroyMethodName : null;
|
this.destroyMethodName = (StringUtils.hasText(destroyMethodName) ? destroyMethodName : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDestroyMethodName() {
|
public String getDestroyMethodName() {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2015 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -96,8 +96,7 @@ public class ResourceBundleEditor extends PropertyEditorSupport {
|
||||||
}
|
}
|
||||||
String localeString = name.substring(separator + 1);
|
String localeString = name.substring(separator + 1);
|
||||||
Locale locale = StringUtils.parseLocaleString(localeString);
|
Locale locale = StringUtils.parseLocaleString(localeString);
|
||||||
setValue((StringUtils.hasText(localeString)) ? ResourceBundle.getBundle(baseName, locale) :
|
setValue(locale != null ? ResourceBundle.getBundle(baseName, locale) : ResourceBundle.getBundle(baseName));
|
||||||
ResourceBundle.getBundle(baseName));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2015 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -110,8 +110,7 @@ public class JCacheCache extends AbstractValueAdaptingCache {
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public T process(MutableEntry<Object, Object> entry, Object... arguments)
|
public T process(MutableEntry<Object, Object> entry, Object... arguments) throws EntryProcessorException {
|
||||||
throws EntryProcessorException {
|
|
||||||
Callable<T> valueLoader = (Callable<T>) arguments[0];
|
Callable<T> valueLoader = (Callable<T>) arguments[0];
|
||||||
if (entry.exists()) {
|
if (entry.exists()) {
|
||||||
return (T) fromStoreValue(entry.getValue());
|
return (T) fromStoreValue(entry.getValue());
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ public class JCacheAspectSupport extends AbstractCacheInvoker implements Initial
|
||||||
protected Object execute(CacheOperationInvoker invoker, Object target, Method method, Object[] args) {
|
protected Object execute(CacheOperationInvoker invoker, Object target, Method method, Object[] args) {
|
||||||
// Check whether aspect is enabled to cope with cases where the AJ is pulled in automatically
|
// Check whether aspect is enabled to cope with cases where the AJ is pulled in automatically
|
||||||
if (this.initialized) {
|
if (this.initialized) {
|
||||||
Class<?> targetClass = getTargetClass(target);
|
Class<?> targetClass = AopProxyUtils.ultimateTargetClass(target);
|
||||||
JCacheOperation<?> operation = getCacheOperationSource().getCacheOperation(method, targetClass);
|
JCacheOperation<?> operation = getCacheOperationSource().getCacheOperation(method, targetClass);
|
||||||
if (operation != null) {
|
if (operation != null) {
|
||||||
CacheOperationInvocationContext<?> context =
|
CacheOperationInvocationContext<?> context =
|
||||||
|
|
@ -114,14 +114,6 @@ public class JCacheAspectSupport extends AbstractCacheInvoker implements Initial
|
||||||
(JCacheOperation<Annotation>) operation, target, args);
|
(JCacheOperation<Annotation>) operation, target, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Class<?> getTargetClass(Object target) {
|
|
||||||
Class<?> targetClass = AopProxyUtils.ultimateTargetClass(target);
|
|
||||||
if (targetClass == null && target != null) {
|
|
||||||
targetClass = target.getClass();
|
|
||||||
}
|
|
||||||
return targetClass;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private Object execute(CacheOperationInvocationContext<?> context, CacheOperationInvoker invoker) {
|
private Object execute(CacheOperationInvocationContext<?> context, CacheOperationInvoker invoker) {
|
||||||
CacheOperationInvoker adapter = new CacheOperationInvokerAdapter(invoker);
|
CacheOperationInvoker adapter = new CacheOperationInvokerAdapter(invoker);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2005 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -35,26 +35,26 @@ import java.util.Date;
|
||||||
*/
|
*/
|
||||||
public interface MailMessage {
|
public interface MailMessage {
|
||||||
|
|
||||||
public void setFrom(String from) throws MailParseException;
|
void setFrom(String from) throws MailParseException;
|
||||||
|
|
||||||
public void setReplyTo(String replyTo) throws MailParseException;
|
void setReplyTo(String replyTo) throws MailParseException;
|
||||||
|
|
||||||
public void setTo(String to) throws MailParseException;
|
void setTo(String to) throws MailParseException;
|
||||||
|
|
||||||
public void setTo(String[] to) throws MailParseException;
|
void setTo(String[] to) throws MailParseException;
|
||||||
|
|
||||||
public void setCc(String cc) throws MailParseException;
|
void setCc(String cc) throws MailParseException;
|
||||||
|
|
||||||
public void setCc(String[] cc) throws MailParseException;
|
void setCc(String[] cc) throws MailParseException;
|
||||||
|
|
||||||
public void setBcc(String bcc) throws MailParseException;
|
void setBcc(String bcc) throws MailParseException;
|
||||||
|
|
||||||
public void setBcc(String[] bcc) throws MailParseException;
|
void setBcc(String[] bcc) throws MailParseException;
|
||||||
|
|
||||||
public void setSentDate(Date sentDate) throws MailParseException;
|
void setSentDate(Date sentDate) throws MailParseException;
|
||||||
|
|
||||||
public void setSubject(String subject) throws MailParseException;
|
void setSubject(String subject) throws MailParseException;
|
||||||
|
|
||||||
public void setText(String text) throws MailParseException;
|
void setText(String text) throws MailParseException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2012 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -68,10 +68,9 @@ public class SimpleMailMessage implements MailMessage, Serializable {
|
||||||
/**
|
/**
|
||||||
* Copy constructor for creating a new {@code SimpleMailMessage} from the state
|
* Copy constructor for creating a new {@code SimpleMailMessage} from the state
|
||||||
* of an existing {@code SimpleMailMessage} instance.
|
* of an existing {@code SimpleMailMessage} instance.
|
||||||
* @throws IllegalArgumentException if the supplied message is {@code null}
|
|
||||||
*/
|
*/
|
||||||
public SimpleMailMessage(SimpleMailMessage original) {
|
public SimpleMailMessage(SimpleMailMessage original) {
|
||||||
Assert.notNull(original, "The 'original' message argument cannot be null");
|
Assert.notNull(original, "'original' message argument must not be null");
|
||||||
this.from = original.getFrom();
|
this.from = original.getFrom();
|
||||||
this.replyTo = original.getReplyTo();
|
this.replyTo = original.getReplyTo();
|
||||||
if (original.getTo() != null) {
|
if (original.getTo() != null) {
|
||||||
|
|
@ -104,7 +103,7 @@ public class SimpleMailMessage implements MailMessage, Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getReplyTo() {
|
public String getReplyTo() {
|
||||||
return replyTo;
|
return this.replyTo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -132,7 +131,7 @@ public class SimpleMailMessage implements MailMessage, Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getCc() {
|
public String[] getCc() {
|
||||||
return cc;
|
return this.cc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -146,7 +145,7 @@ public class SimpleMailMessage implements MailMessage, Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getBcc() {
|
public String[] getBcc() {
|
||||||
return bcc;
|
return this.bcc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -155,7 +154,7 @@ public class SimpleMailMessage implements MailMessage, Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getSentDate() {
|
public Date getSentDate() {
|
||||||
return sentDate;
|
return this.sentDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -201,16 +201,16 @@ class AnnotationDrivenCacheBeanDefinitionParser implements BeanDefinitionParser
|
||||||
|
|
||||||
private static void registerCacheAdvisor(Element element, ParserContext parserContext) {
|
private static void registerCacheAdvisor(Element element, ParserContext parserContext) {
|
||||||
if (!parserContext.getRegistry().containsBeanDefinition(CacheManagementConfigUtils.JCACHE_ADVISOR_BEAN_NAME)) {
|
if (!parserContext.getRegistry().containsBeanDefinition(CacheManagementConfigUtils.JCACHE_ADVISOR_BEAN_NAME)) {
|
||||||
Object eleSource = parserContext.extractSource(element);
|
Object source = parserContext.extractSource(element);
|
||||||
|
|
||||||
// Create the CacheOperationSource definition.
|
// Create the CacheOperationSource definition.
|
||||||
BeanDefinition sourceDef = createJCacheOperationSourceBeanDefinition(element, eleSource);
|
BeanDefinition sourceDef = createJCacheOperationSourceBeanDefinition(element, source);
|
||||||
String sourceName = parserContext.getReaderContext().registerWithGeneratedName(sourceDef);
|
String sourceName = parserContext.getReaderContext().registerWithGeneratedName(sourceDef);
|
||||||
|
|
||||||
// Create the CacheInterceptor definition.
|
// Create the CacheInterceptor definition.
|
||||||
RootBeanDefinition interceptorDef =
|
RootBeanDefinition interceptorDef =
|
||||||
new RootBeanDefinition("org.springframework.cache.jcache.interceptor.JCacheInterceptor");
|
new RootBeanDefinition("org.springframework.cache.jcache.interceptor.JCacheInterceptor");
|
||||||
interceptorDef.setSource(eleSource);
|
interceptorDef.setSource(source);
|
||||||
interceptorDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
|
interceptorDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
|
||||||
interceptorDef.getPropertyValues().add("cacheOperationSource", new RuntimeBeanReference(sourceName));
|
interceptorDef.getPropertyValues().add("cacheOperationSource", new RuntimeBeanReference(sourceName));
|
||||||
parseErrorHandler(element, interceptorDef);
|
parseErrorHandler(element, interceptorDef);
|
||||||
|
|
@ -219,7 +219,7 @@ class AnnotationDrivenCacheBeanDefinitionParser implements BeanDefinitionParser
|
||||||
// Create the CacheAdvisor definition.
|
// Create the CacheAdvisor definition.
|
||||||
RootBeanDefinition advisorDef = new RootBeanDefinition(
|
RootBeanDefinition advisorDef = new RootBeanDefinition(
|
||||||
"org.springframework.cache.jcache.interceptor.BeanFactoryJCacheOperationSourceAdvisor");
|
"org.springframework.cache.jcache.interceptor.BeanFactoryJCacheOperationSourceAdvisor");
|
||||||
advisorDef.setSource(eleSource);
|
advisorDef.setSource(source);
|
||||||
advisorDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
|
advisorDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
|
||||||
advisorDef.getPropertyValues().add("cacheOperationSource", new RuntimeBeanReference(sourceName));
|
advisorDef.getPropertyValues().add("cacheOperationSource", new RuntimeBeanReference(sourceName));
|
||||||
advisorDef.getPropertyValues().add("adviceBeanName", interceptorName);
|
advisorDef.getPropertyValues().add("adviceBeanName", interceptorName);
|
||||||
|
|
@ -228,7 +228,7 @@ class AnnotationDrivenCacheBeanDefinitionParser implements BeanDefinitionParser
|
||||||
}
|
}
|
||||||
parserContext.getRegistry().registerBeanDefinition(CacheManagementConfigUtils.JCACHE_ADVISOR_BEAN_NAME, advisorDef);
|
parserContext.getRegistry().registerBeanDefinition(CacheManagementConfigUtils.JCACHE_ADVISOR_BEAN_NAME, advisorDef);
|
||||||
|
|
||||||
CompositeComponentDefinition compositeDef = new CompositeComponentDefinition(element.getTagName(), eleSource);
|
CompositeComponentDefinition compositeDef = new CompositeComponentDefinition(element.getTagName(), source);
|
||||||
compositeDef.addNestedComponent(new BeanComponentDefinition(sourceDef, sourceName));
|
compositeDef.addNestedComponent(new BeanComponentDefinition(sourceDef, sourceName));
|
||||||
compositeDef.addNestedComponent(new BeanComponentDefinition(interceptorDef, interceptorName));
|
compositeDef.addNestedComponent(new BeanComponentDefinition(interceptorDef, interceptorName));
|
||||||
compositeDef.addNestedComponent(new BeanComponentDefinition(advisorDef, CacheManagementConfigUtils.JCACHE_ADVISOR_BEAN_NAME));
|
compositeDef.addNestedComponent(new BeanComponentDefinition(advisorDef, CacheManagementConfigUtils.JCACHE_ADVISOR_BEAN_NAME));
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -196,7 +196,7 @@ class CacheAdviceParser extends AbstractSingleBeanDefinitionParser {
|
||||||
|
|
||||||
private String method;
|
private String method;
|
||||||
|
|
||||||
private String[] caches = null;
|
private String[] caches;
|
||||||
|
|
||||||
Props(Element root) {
|
Props(Element root) {
|
||||||
String defaultCache = root.getAttribute("cache");
|
String defaultCache = root.getAttribute("cache");
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -164,7 +164,6 @@ public abstract class CacheAspectSupport extends AbstractCacheInvoker
|
||||||
* @see SimpleCacheResolver
|
* @see SimpleCacheResolver
|
||||||
*/
|
*/
|
||||||
public void setCacheResolver(CacheResolver cacheResolver) {
|
public void setCacheResolver(CacheResolver cacheResolver) {
|
||||||
Assert.notNull(cacheResolver, "CacheResolver must not be null");
|
|
||||||
this.cacheResolver = cacheResolver;
|
this.cacheResolver = cacheResolver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -140,9 +140,6 @@ class CacheOperationExpressionEvaluator extends CachedExpressionEvaluator {
|
||||||
Method targetMethod = this.targetMethodCache.get(methodKey);
|
Method targetMethod = this.targetMethodCache.get(methodKey);
|
||||||
if (targetMethod == null) {
|
if (targetMethod == null) {
|
||||||
targetMethod = AopUtils.getMostSpecificMethod(method, targetClass);
|
targetMethod = AopUtils.getMostSpecificMethod(method, targetClass);
|
||||||
if (targetMethod == null) {
|
|
||||||
targetMethod = method;
|
|
||||||
}
|
|
||||||
this.targetMethodCache.put(methodKey, targetMethod);
|
this.targetMethodCache.put(methodKey, targetMethod);
|
||||||
}
|
}
|
||||||
return targetMethod;
|
return targetMethod;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2010-2012 the original author or authors.
|
* Copyright 2010-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -35,6 +35,7 @@ import org.springframework.aop.support.DefaultPointcutAdvisor;
|
||||||
* of the Spring reference documentation for more information.
|
* of the Spring reference documentation for more information.
|
||||||
*
|
*
|
||||||
* @author Costin Leau
|
* @author Costin Leau
|
||||||
|
* @author Juergen Hoeller
|
||||||
* @since 3.1
|
* @since 3.1
|
||||||
* @see org.springframework.aop.framework.ProxyFactoryBean
|
* @see org.springframework.aop.framework.ProxyFactoryBean
|
||||||
* @see CacheInterceptor
|
* @see CacheInterceptor
|
||||||
|
|
@ -44,9 +45,16 @@ public class CacheProxyFactoryBean extends AbstractSingletonProxyFactoryBean {
|
||||||
|
|
||||||
private final CacheInterceptor cachingInterceptor = new CacheInterceptor();
|
private final CacheInterceptor cachingInterceptor = new CacheInterceptor();
|
||||||
|
|
||||||
private Pointcut pointcut;
|
private Pointcut pointcut = Pointcut.TRUE;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the sources used to find cache operations.
|
||||||
|
*/
|
||||||
|
public void setCacheOperationSources(CacheOperationSource... cacheOperationSources) {
|
||||||
|
this.cachingInterceptor.setCacheOperationSources(cacheOperationSources);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a pointcut, i.e a bean that can cause conditional invocation
|
* Set a pointcut, i.e a bean that can cause conditional invocation
|
||||||
* of the CacheInterceptor depending on method and attributes passed.
|
* of the CacheInterceptor depending on method and attributes passed.
|
||||||
|
|
@ -61,18 +69,7 @@ public class CacheProxyFactoryBean extends AbstractSingletonProxyFactoryBean {
|
||||||
@Override
|
@Override
|
||||||
protected Object createMainInterceptor() {
|
protected Object createMainInterceptor() {
|
||||||
this.cachingInterceptor.afterPropertiesSet();
|
this.cachingInterceptor.afterPropertiesSet();
|
||||||
if (this.pointcut == null) {
|
|
||||||
// Rely on default pointcut.
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
return new DefaultPointcutAdvisor(this.pointcut, this.cachingInterceptor);
|
return new DefaultPointcutAdvisor(this.pointcut, this.cachingInterceptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the sources used to find cache operations.
|
|
||||||
*/
|
|
||||||
public void setCacheOperationSources(CacheOperationSource... cacheOperationSources) {
|
|
||||||
this.cachingInterceptor.setCacheOperationSources(cacheOperationSources);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -19,10 +19,10 @@ package org.springframework.cache.support;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
import org.springframework.cache.Cache;
|
import org.springframework.cache.Cache;
|
||||||
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A no operation {@link Cache} implementation suitable
|
* A no operation {@link Cache} implementation suitable for disabling caching.
|
||||||
* for disabling caching.
|
|
||||||
*
|
*
|
||||||
* <p>Will simply accept any items into the cache not actually storing them.
|
* <p>Will simply accept any items into the cache not actually storing them.
|
||||||
*
|
*
|
||||||
|
|
@ -34,20 +34,25 @@ public class NoOpCache implements Cache {
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a {@link NoOpCache} instance with the specified name
|
* Create a {@link NoOpCache} instance with the specified name
|
||||||
* @param name the name of the cache
|
* @param name the name of the cache
|
||||||
*/
|
*/
|
||||||
public NoOpCache(String name) {
|
public NoOpCache(String name) {
|
||||||
|
Assert.notNull(name, "Cache name must not be null");
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void clear() {
|
public String getName() {
|
||||||
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void evict(Object key) {
|
public Object getNativeCache() {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -70,16 +75,6 @@ public class NoOpCache implements Cache {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return this.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object getNativeCache() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void put(Object key, Object value) {
|
public void put(Object key, Object value) {
|
||||||
}
|
}
|
||||||
|
|
@ -89,4 +84,12 @@ public class NoOpCache implements Cache {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void evict(Object key) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clear() {
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -66,8 +66,8 @@ class ComponentScanAnnotationParser {
|
||||||
public ComponentScanAnnotationParser(Environment environment, ResourceLoader resourceLoader,
|
public ComponentScanAnnotationParser(Environment environment, ResourceLoader resourceLoader,
|
||||||
BeanNameGenerator beanNameGenerator, BeanDefinitionRegistry registry) {
|
BeanNameGenerator beanNameGenerator, BeanDefinitionRegistry registry) {
|
||||||
|
|
||||||
this.resourceLoader = resourceLoader;
|
|
||||||
this.environment = environment;
|
this.environment = environment;
|
||||||
|
this.resourceLoader = resourceLoader;
|
||||||
this.beanNameGenerator = beanNameGenerator;
|
this.beanNameGenerator = beanNameGenerator;
|
||||||
this.registry = registry;
|
this.registry = registry;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2015 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -121,7 +121,7 @@ public class MBeanExportConfiguration implements ImportAware, EnvironmentAware,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static enum SpecificPlatform {
|
public enum SpecificPlatform {
|
||||||
|
|
||||||
WEBLOGIC("weblogic.management.Helper") {
|
WEBLOGIC("weblogic.management.Helper") {
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -146,7 +146,7 @@ public class MBeanExportConfiguration implements ImportAware, EnvironmentAware,
|
||||||
|
|
||||||
private final String identifyingClass;
|
private final String identifyingClass;
|
||||||
|
|
||||||
private SpecificPlatform(String identifyingClass) {
|
SpecificPlatform(String identifyingClass) {
|
||||||
this.identifyingClass = identifyingClass;
|
this.identifyingClass = identifyingClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -68,8 +68,8 @@ class EventExpressionEvaluator extends CachedExpressionEvaluator {
|
||||||
public boolean condition(String conditionExpression,
|
public boolean condition(String conditionExpression,
|
||||||
AnnotatedElementKey elementKey, EvaluationContext evalContext) {
|
AnnotatedElementKey elementKey, EvaluationContext evalContext) {
|
||||||
|
|
||||||
return getExpression(this.conditionCache, elementKey, conditionExpression)
|
return getExpression(this.conditionCache, elementKey, conditionExpression).getValue(
|
||||||
.getValue(evalContext, boolean.class);
|
evalContext, boolean.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Method getTargetMethod(Class<?> targetClass, Method method) {
|
private Method getTargetMethod(Class<?> targetClass, Method method) {
|
||||||
|
|
@ -77,9 +77,6 @@ class EventExpressionEvaluator extends CachedExpressionEvaluator {
|
||||||
Method targetMethod = this.targetMethodCache.get(methodKey);
|
Method targetMethod = this.targetMethodCache.get(methodKey);
|
||||||
if (targetMethod == null) {
|
if (targetMethod == null) {
|
||||||
targetMethod = AopUtils.getMostSpecificMethod(method, targetClass);
|
targetMethod = AopUtils.getMostSpecificMethod(method, targetClass);
|
||||||
if (targetMethod == null) {
|
|
||||||
targetMethod = method;
|
|
||||||
}
|
|
||||||
this.targetMethodCache.put(methodKey, targetMethod);
|
this.targetMethodCache.put(methodKey, targetMethod);
|
||||||
}
|
}
|
||||||
return targetMethod;
|
return targetMethod;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2012 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -64,15 +64,14 @@ public class EventPublicationInterceptor
|
||||||
*/
|
*/
|
||||||
public void setApplicationEventClass(Class<?> applicationEventClass) {
|
public void setApplicationEventClass(Class<?> applicationEventClass) {
|
||||||
if (ApplicationEvent.class == applicationEventClass ||
|
if (ApplicationEvent.class == applicationEventClass ||
|
||||||
!ApplicationEvent.class.isAssignableFrom(applicationEventClass)) {
|
!ApplicationEvent.class.isAssignableFrom(applicationEventClass)) {
|
||||||
throw new IllegalArgumentException("applicationEventClass needs to extend ApplicationEvent");
|
throw new IllegalArgumentException("'applicationEventClass' needs to extend ApplicationEvent");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
this.applicationEventClassConstructor =
|
this.applicationEventClassConstructor = applicationEventClass.getConstructor(Object.class);
|
||||||
applicationEventClass.getConstructor(new Class<?>[] {Object.class});
|
|
||||||
}
|
}
|
||||||
catch (NoSuchMethodException ex) {
|
catch (NoSuchMethodException ex) {
|
||||||
throw new IllegalArgumentException("applicationEventClass [" +
|
throw new IllegalArgumentException("ApplicationEvent class [" +
|
||||||
applicationEventClass.getName() + "] does not have the required Object constructor: " + ex);
|
applicationEventClass.getName() + "] does not have the required Object constructor: " + ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -85,7 +84,7 @@ public class EventPublicationInterceptor
|
||||||
@Override
|
@Override
|
||||||
public void afterPropertiesSet() throws Exception {
|
public void afterPropertiesSet() throws Exception {
|
||||||
if (this.applicationEventClassConstructor == null) {
|
if (this.applicationEventClassConstructor == null) {
|
||||||
throw new IllegalArgumentException("applicationEventClass is required");
|
throw new IllegalArgumentException("Property 'applicationEventClass' is required");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -95,7 +94,7 @@ public class EventPublicationInterceptor
|
||||||
Object retVal = invocation.proceed();
|
Object retVal = invocation.proceed();
|
||||||
|
|
||||||
ApplicationEvent event = (ApplicationEvent)
|
ApplicationEvent event = (ApplicationEvent)
|
||||||
this.applicationEventClassConstructor.newInstance(new Object[] {invocation.getThis()});
|
this.applicationEventClassConstructor.newInstance(invocation.getThis());
|
||||||
this.applicationEventPublisher.publishEvent(event);
|
this.applicationEventPublisher.publishEvent(event);
|
||||||
|
|
||||||
return retVal;
|
return retVal;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -75,12 +75,8 @@ public class GenericApplicationListenerAdapter implements GenericApplicationList
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supportsSourceType(Class<?> sourceType) {
|
public boolean supportsSourceType(Class<?> sourceType) {
|
||||||
if (this.delegate instanceof SmartApplicationListener) {
|
return !(this.delegate instanceof SmartApplicationListener) ||
|
||||||
return ((SmartApplicationListener) this.delegate).supportsSourceType(sourceType);
|
((SmartApplicationListener) this.delegate).supportsSourceType(sourceType);
|
||||||
}
|
|
||||||
else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -91,17 +87,13 @@ public class GenericApplicationListenerAdapter implements GenericApplicationList
|
||||||
|
|
||||||
static ResolvableType resolveDeclaredEventType(Class<?> listenerType) {
|
static ResolvableType resolveDeclaredEventType(Class<?> listenerType) {
|
||||||
ResolvableType resolvableType = ResolvableType.forClass(listenerType).as(ApplicationListener.class);
|
ResolvableType resolvableType = ResolvableType.forClass(listenerType).as(ApplicationListener.class);
|
||||||
if (resolvableType == null || !resolvableType.hasGenerics()) {
|
return (resolvableType.hasGenerics() ? resolvableType.getGeneric() : null);
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return resolvableType.getGeneric();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ResolvableType resolveDeclaredEventType(ApplicationListener<ApplicationEvent> listener) {
|
private static ResolvableType resolveDeclaredEventType(ApplicationListener<ApplicationEvent> listener) {
|
||||||
ResolvableType declaredEventType = resolveDeclaredEventType(listener.getClass());
|
ResolvableType declaredEventType = resolveDeclaredEventType(listener.getClass());
|
||||||
if (declaredEventType == null || declaredEventType.isAssignableFrom(
|
if (declaredEventType == null || declaredEventType.isAssignableFrom(
|
||||||
ResolvableType.forClass(ApplicationEvent.class))) {
|
ResolvableType.forClass(ApplicationEvent.class))) {
|
||||||
|
|
||||||
Class<?> targetClass = AopUtils.getTargetClass(listener);
|
Class<?> targetClass = AopUtils.getTargetClass(listener);
|
||||||
if (targetClass != listener.getClass()) {
|
if (targetClass != listener.getClass()) {
|
||||||
declaredEventType = resolveDeclaredEventType(targetClass);
|
declaredEventType = resolveDeclaredEventType(targetClass);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -75,6 +75,9 @@ public final class AnnotatedElementKey implements Comparable<AnnotatedElementKey
|
||||||
public int compareTo(AnnotatedElementKey other) {
|
public int compareTo(AnnotatedElementKey other) {
|
||||||
int result = this.element.toString().compareTo(other.element.toString());
|
int result = this.element.toString().compareTo(other.element.toString());
|
||||||
if (result == 0 && this.targetClass != null) {
|
if (result == 0 && this.targetClass != null) {
|
||||||
|
if (other.targetClass == null) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
result = this.targetClass.getName().compareTo(other.targetClass.getName());
|
result = this.targetClass.getName().compareTo(other.targetClass.getName());
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2015 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -68,27 +68,6 @@ public class MapAccessor implements CompilablePropertyAccessor {
|
||||||
map.put(name, newValue);
|
map.put(name, newValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Exception thrown from {@code read} in order to reset a cached
|
|
||||||
* PropertyAccessor, allowing other accessors to have a try.
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("serial")
|
|
||||||
private static class MapAccessException extends AccessException {
|
|
||||||
|
|
||||||
private final String key;
|
|
||||||
|
|
||||||
public MapAccessException(String key) {
|
|
||||||
super(null);
|
|
||||||
this.key = key;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getMessage() {
|
|
||||||
return "Map does not contain a value for key '" + this.key + "'";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isCompilable() {
|
public boolean isCompilable() {
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -112,4 +91,25 @@ public class MapAccessor implements CompilablePropertyAccessor {
|
||||||
mv.visitMethodInsn(INVOKEINTERFACE, "java/util/Map", "get","(Ljava/lang/Object;)Ljava/lang/Object;",true);
|
mv.visitMethodInsn(INVOKEINTERFACE, "java/util/Map", "get","(Ljava/lang/Object;)Ljava/lang/Object;",true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exception thrown from {@code read} in order to reset a cached
|
||||||
|
* PropertyAccessor, allowing other accessors to have a try.
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("serial")
|
||||||
|
private static class MapAccessException extends AccessException {
|
||||||
|
|
||||||
|
private final String key;
|
||||||
|
|
||||||
|
public MapAccessException(String key) {
|
||||||
|
super(null);
|
||||||
|
this.key = key;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMessage() {
|
||||||
|
return "Map does not contain a value for key '" + this.key + "'";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2014 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -160,7 +160,7 @@ public class StandardBeanExpressionResolver implements BeanExpressionResolver {
|
||||||
}
|
}
|
||||||
return expr.getValue(sec);
|
return expr.getValue(sec);
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Throwable ex) {
|
||||||
throw new BeanExpressionException("Expression parsing failed", ex);
|
throw new BeanExpressionException("Expression parsing failed", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -96,11 +96,6 @@ public class DefaultMessageSourceResolvable implements MessageSourceResolvable,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String[] getCodes() {
|
|
||||||
return this.codes;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the default code of this resolvable, that is,
|
* Return the default code of this resolvable, that is,
|
||||||
* the last one in the codes array.
|
* the last one in the codes array.
|
||||||
|
|
@ -109,6 +104,11 @@ public class DefaultMessageSourceResolvable implements MessageSourceResolvable,
|
||||||
return (this.codes != null && this.codes.length > 0 ? this.codes[this.codes.length - 1] : null);
|
return (this.codes != null && this.codes.length > 0 ? this.codes[this.codes.length - 1] : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] getCodes() {
|
||||||
|
return this.codes;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object[] getArguments() {
|
public Object[] getArguments() {
|
||||||
return this.arguments;
|
return this.arguments;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2012 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -40,6 +40,7 @@ public class MessageSourceAccessor {
|
||||||
|
|
||||||
private final Locale defaultLocale;
|
private final Locale defaultLocale;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new MessageSourceAccessor, using LocaleContextHolder's locale
|
* Create a new MessageSourceAccessor, using LocaleContextHolder's locale
|
||||||
* as default locale.
|
* as default locale.
|
||||||
|
|
@ -61,6 +62,7 @@ public class MessageSourceAccessor {
|
||||||
this.defaultLocale = defaultLocale;
|
this.defaultLocale = defaultLocale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the default locale to use if no explicit locale has been given.
|
* Return the default locale to use if no explicit locale has been given.
|
||||||
* <p>The default implementation returns the default locale passed into the
|
* <p>The default implementation returns the default locale passed into the
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2015 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -67,12 +67,12 @@ public class SimpleThreadScope implements Scope {
|
||||||
@Override
|
@Override
|
||||||
public Object get(String name, ObjectFactory<?> objectFactory) {
|
public Object get(String name, ObjectFactory<?> objectFactory) {
|
||||||
Map<String, Object> scope = this.threadScope.get();
|
Map<String, Object> scope = this.threadScope.get();
|
||||||
Object object = scope.get(name);
|
Object scopedObject = scope.get(name);
|
||||||
if (object == null) {
|
if (scopedObject == null) {
|
||||||
object = objectFactory.getObject();
|
scopedObject = objectFactory.getObject();
|
||||||
scope.put(name, object);
|
scope.put(name, scopedObject);
|
||||||
}
|
}
|
||||||
return object;
|
return scopedObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2015 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -72,7 +72,7 @@ public class CurrencyStyleFormatter extends AbstractNumberFormatter {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the pattern to use to format number values.
|
* Specify the pattern to use to format number values.
|
||||||
* If not specified, the default DecimalFormat pattern is used.
|
* If not specified, the default DecimalFormat pattern is used.
|
||||||
* @see java.text.DecimalFormat#applyPattern(String)
|
* @see java.text.DecimalFormat#applyPattern(String)
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2015 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2015 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -56,7 +56,7 @@ public class NumberStyleFormatter extends AbstractNumberFormatter {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the pattern to use to format number values.
|
* Specify the pattern to use to format number values.
|
||||||
* If not specified, the default DecimalFormat pattern is used.
|
* If not specified, the default DecimalFormat pattern is used.
|
||||||
* @see java.text.DecimalFormat#applyPattern(String)
|
* @see java.text.DecimalFormat#applyPattern(String)
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -48,10 +48,20 @@ public class GlassFishLoadTimeWeaver implements LoadTimeWeaver {
|
||||||
private final Method copyMethod;
|
private final Method copyMethod;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new instance of the {@link GlassFishLoadTimeWeaver} class using
|
||||||
|
* the default {@link ClassLoader class loader}.
|
||||||
|
* @see org.springframework.util.ClassUtils#getDefaultClassLoader()
|
||||||
|
*/
|
||||||
public GlassFishLoadTimeWeaver() {
|
public GlassFishLoadTimeWeaver() {
|
||||||
this(ClassUtils.getDefaultClassLoader());
|
this(ClassUtils.getDefaultClassLoader());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new instance of the {@link GlassFishLoadTimeWeaver} class using
|
||||||
|
* the supplied {@link ClassLoader}.
|
||||||
|
* @param classLoader the {@code ClassLoader} to delegate to for weaving
|
||||||
|
*/
|
||||||
public GlassFishLoadTimeWeaver(ClassLoader classLoader) {
|
public GlassFishLoadTimeWeaver(ClassLoader classLoader) {
|
||||||
Assert.notNull(classLoader, "ClassLoader must not be null");
|
Assert.notNull(classLoader, "ClassLoader must not be null");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2014 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -41,9 +41,7 @@ class WebLogicClassPreProcessorAdapter implements InvocationHandler {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new {@link WebLogicClassPreProcessorAdapter}.
|
* Construct a new {@link WebLogicClassPreProcessorAdapter}.
|
||||||
* @param transformer the {@link ClassFileTransformer} to be adapted
|
|
||||||
* (must not be {@code null})
|
|
||||||
*/
|
*/
|
||||||
public WebLogicClassPreProcessorAdapter(ClassFileTransformer transformer, ClassLoader loader) {
|
public WebLogicClassPreProcessorAdapter(ClassFileTransformer transformer, ClassLoader loader) {
|
||||||
this.transformer = transformer;
|
this.transformer = transformer;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -25,7 +25,7 @@ import org.springframework.util.ClassUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link LoadTimeWeaver} implementation for WebSphere's instrumentable ClassLoader.
|
* {@link LoadTimeWeaver} implementation for WebSphere's instrumentable ClassLoader.
|
||||||
* Compatible with WebSphere 7 as well as 8.
|
* Compatible with WebSphere 7 as well as 8 and 9.
|
||||||
*
|
*
|
||||||
* @author Costin Leau
|
* @author Costin Leau
|
||||||
* @since 3.1
|
* @since 3.1
|
||||||
|
|
@ -48,7 +48,6 @@ public class WebSphereLoadTimeWeaver implements LoadTimeWeaver {
|
||||||
* Create a new instance of the {@link WebSphereLoadTimeWeaver} class using
|
* Create a new instance of the {@link WebSphereLoadTimeWeaver} class using
|
||||||
* the supplied {@link ClassLoader}.
|
* the supplied {@link ClassLoader}.
|
||||||
* @param classLoader the {@code ClassLoader} to delegate to for weaving
|
* @param classLoader the {@code ClassLoader} to delegate to for weaving
|
||||||
* (must not be {@code null})
|
|
||||||
*/
|
*/
|
||||||
public WebSphereLoadTimeWeaver(ClassLoader classLoader) {
|
public WebSphereLoadTimeWeaver(ClassLoader classLoader) {
|
||||||
Assert.notNull(classLoader, "ClassLoader must not be null");
|
Assert.notNull(classLoader, "ClassLoader must not be null");
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2012 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -60,21 +60,14 @@ import org.springframework.util.StringUtils;
|
||||||
public class InterfaceBasedMBeanInfoAssembler extends AbstractConfigurableMBeanInfoAssembler
|
public class InterfaceBasedMBeanInfoAssembler extends AbstractConfigurableMBeanInfoAssembler
|
||||||
implements BeanClassLoaderAware, InitializingBean {
|
implements BeanClassLoaderAware, InitializingBean {
|
||||||
|
|
||||||
/**
|
|
||||||
* Stores the array of interfaces to use for creating the management interface.
|
|
||||||
*/
|
|
||||||
private Class<?>[] managedInterfaces;
|
private Class<?>[] managedInterfaces;
|
||||||
|
|
||||||
/**
|
/** Mappings of bean keys to an array of classes */
|
||||||
* Stores the mappings of bean keys to an array of {@code Class}es.
|
|
||||||
*/
|
|
||||||
private Properties interfaceMappings;
|
private Properties interfaceMappings;
|
||||||
|
|
||||||
private ClassLoader beanClassLoader = ClassUtils.getDefaultClassLoader();
|
private ClassLoader beanClassLoader = ClassUtils.getDefaultClassLoader();
|
||||||
|
|
||||||
/**
|
/** Mappings of bean keys to an array of classes */
|
||||||
* Stores the mappings of bean keys to an array of {@code Class}es.
|
|
||||||
*/
|
|
||||||
private Map<String, Class<?>[]> resolvedInterfaceMappings;
|
private Map<String, Class<?>[]> resolvedInterfaceMappings;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -86,7 +79,7 @@ public class InterfaceBasedMBeanInfoAssembler extends AbstractConfigurableMBeanI
|
||||||
* Each entry <strong>MUST</strong> be an interface.
|
* Each entry <strong>MUST</strong> be an interface.
|
||||||
* @see #setInterfaceMappings
|
* @see #setInterfaceMappings
|
||||||
*/
|
*/
|
||||||
public void setManagedInterfaces(Class<?>[] managedInterfaces) {
|
public void setManagedInterfaces(Class<?>... managedInterfaces) {
|
||||||
if (managedInterfaces != null) {
|
if (managedInterfaces != null) {
|
||||||
for (Class<?> ifc : managedInterfaces) {
|
for (Class<?> ifc : managedInterfaces) {
|
||||||
if (!ifc.isInterface()) {
|
if (!ifc.isInterface()) {
|
||||||
|
|
@ -103,7 +96,7 @@ public class InterfaceBasedMBeanInfoAssembler extends AbstractConfigurableMBeanI
|
||||||
* <p>The property key should match the bean key and the property value should match
|
* <p>The property key should match the bean key and the property value should match
|
||||||
* the list of interface names. When searching for interfaces for a bean, Spring
|
* the list of interface names. When searching for interfaces for a bean, Spring
|
||||||
* will check these mappings first.
|
* will check these mappings first.
|
||||||
* @param mappings the mappins of bean keys to interface names
|
* @param mappings the mappings of bean keys to interface names
|
||||||
*/
|
*/
|
||||||
public void setInterfaceMappings(Properties mappings) {
|
public void setInterfaceMappings(Properties mappings) {
|
||||||
this.interfaceMappings = mappings;
|
this.interfaceMappings = mappings;
|
||||||
|
|
@ -230,13 +223,11 @@ public class InterfaceBasedMBeanInfoAssembler extends AbstractConfigurableMBeanI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ifaces != null) {
|
for (Class<?> ifc : ifaces) {
|
||||||
for (Class<?> ifc : ifaces) {
|
for (Method ifcMethod : ifc.getMethods()) {
|
||||||
for (Method ifcMethod : ifc.getMethods()) {
|
if (ifcMethod.getName().equals(method.getName()) &&
|
||||||
if (ifcMethod.getName().equals(method.getName()) &&
|
Arrays.equals(ifcMethod.getParameterTypes(), method.getParameterTypes())) {
|
||||||
Arrays.equals(ifcMethod.getParameterTypes(), method.getParameterTypes())) {
|
return true;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2013 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -34,18 +34,17 @@ import org.springframework.jmx.export.metadata.ManagedNotification;
|
||||||
import org.springframework.jmx.export.metadata.ManagedOperation;
|
import org.springframework.jmx.export.metadata.ManagedOperation;
|
||||||
import org.springframework.jmx.export.metadata.ManagedOperationParameter;
|
import org.springframework.jmx.export.metadata.ManagedOperationParameter;
|
||||||
import org.springframework.jmx.export.metadata.ManagedResource;
|
import org.springframework.jmx.export.metadata.ManagedResource;
|
||||||
import org.springframework.jmx.support.MetricType;
|
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of the {@link MBeanInfoAssembler}
|
* Implementation of the {@link MBeanInfoAssembler} interface that reads
|
||||||
* interface that reads the management interface information from source level metadata.
|
* the management interface information from source level metadata.
|
||||||
*
|
*
|
||||||
* <p>Uses the {@link JmxAttributeSource} strategy interface, so that
|
* <p>Uses the {@link JmxAttributeSource} strategy interface, so that
|
||||||
* metadata can be read using any supported implementation. Out of the box,
|
* metadata can be read using any supported implementation. Out of the box,
|
||||||
* Spring provides an implementation based on JDK 1.5+ annotations,
|
* Spring provides an implementation based on annotations:
|
||||||
* {@code AnnotationJmxAttributeSource}.
|
* {@code AnnotationJmxAttributeSource}.
|
||||||
*
|
*
|
||||||
* @author Rob Harrop
|
* @author Rob Harrop
|
||||||
|
|
@ -339,9 +338,9 @@ public class MetadataMBeanInfoAssembler extends AbstractReflectiveMBeanInfoAssem
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ManagedAttribute gma =
|
ManagedAttribute gma =
|
||||||
(getter == null) ? ManagedAttribute.EMPTY : this.attributeSource.getManagedAttribute(getter);
|
(getter == null) ? ManagedAttribute.EMPTY : this.attributeSource.getManagedAttribute(getter);
|
||||||
ManagedAttribute sma =
|
ManagedAttribute sma =
|
||||||
(setter == null) ? ManagedAttribute.EMPTY : this.attributeSource.getManagedAttribute(setter);
|
(setter == null) ? ManagedAttribute.EMPTY : this.attributeSource.getManagedAttribute(setter);
|
||||||
populateAttributeDescriptor(desc,gma,sma);
|
populateAttributeDescriptor(desc,gma,sma);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -384,8 +383,7 @@ public class MetadataMBeanInfoAssembler extends AbstractReflectiveMBeanInfoAssem
|
||||||
desc.setField(FIELD_METRIC_CATEGORY, metric.getCategory());
|
desc.setField(FIELD_METRIC_CATEGORY, metric.getCategory());
|
||||||
}
|
}
|
||||||
|
|
||||||
String metricType = (metric.getMetricType() == null) ? MetricType.GAUGE.toString() : metric.getMetricType().toString();
|
desc.setField(FIELD_METRIC_TYPE, metric.getMetricType().toString());
|
||||||
desc.setField(FIELD_METRIC_TYPE, metricType);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2005 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -18,6 +18,7 @@ package org.springframework.jmx.export.metadata;
|
||||||
|
|
||||||
import javax.management.modelmbean.ModelMBeanNotificationInfo;
|
import javax.management.modelmbean.ModelMBeanNotificationInfo;
|
||||||
|
|
||||||
|
import org.springframework.util.ObjectUtils;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -34,16 +35,16 @@ public abstract class JmxMetadataUtils {
|
||||||
* {@link javax.management.modelmbean.ModelMBeanNotificationInfo}.
|
* {@link javax.management.modelmbean.ModelMBeanNotificationInfo}.
|
||||||
*/
|
*/
|
||||||
public static ModelMBeanNotificationInfo convertToModelMBeanNotificationInfo(ManagedNotification notificationInfo) {
|
public static ModelMBeanNotificationInfo convertToModelMBeanNotificationInfo(ManagedNotification notificationInfo) {
|
||||||
|
String[] notifTypes = notificationInfo.getNotificationTypes();
|
||||||
|
if (ObjectUtils.isEmpty(notifTypes)) {
|
||||||
|
throw new IllegalArgumentException("Must specify at least one notification type");
|
||||||
|
}
|
||||||
|
|
||||||
String name = notificationInfo.getName();
|
String name = notificationInfo.getName();
|
||||||
if (!StringUtils.hasText(name)) {
|
if (!StringUtils.hasText(name)) {
|
||||||
throw new IllegalArgumentException("Must specify notification name");
|
throw new IllegalArgumentException("Must specify notification name");
|
||||||
}
|
}
|
||||||
|
|
||||||
String[] notifTypes = notificationInfo.getNotificationTypes();
|
|
||||||
if (notifTypes == null || notifTypes.length == 0) {
|
|
||||||
throw new IllegalArgumentException("Must specify at least one notification type");
|
|
||||||
}
|
|
||||||
|
|
||||||
String description = notificationInfo.getDescription();
|
String description = notificationInfo.getDescription();
|
||||||
return new ModelMBeanNotificationInfo(notifTypes, name, description);
|
return new ModelMBeanNotificationInfo(notifTypes, name, description);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2009 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
package org.springframework.jmx.export.metadata;
|
package org.springframework.jmx.export.metadata;
|
||||||
|
|
||||||
import org.springframework.jmx.support.MetricType;
|
import org.springframework.jmx.support.MetricType;
|
||||||
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Metadata that indicates to expose a given bean property as a JMX attribute,
|
* Metadata that indicates to expose a given bean property as a JMX attribute,
|
||||||
|
|
@ -74,6 +75,7 @@ public class ManagedMetric extends AbstractJmxAttribute {
|
||||||
* A description of how this metric's values change over time.
|
* A description of how this metric's values change over time.
|
||||||
*/
|
*/
|
||||||
public void setMetricType(MetricType metricType) {
|
public void setMetricType(MetricType metricType) {
|
||||||
|
Assert.notNull(metricType, "MetricType must not be null");
|
||||||
this.metricType = metricType;
|
this.metricType = metricType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2012 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -105,17 +105,14 @@ public class KeyNamingStrategy implements ObjectNamingStrategy, InitializingBean
|
||||||
* Merges the {@code Properties} configured in the {@code mappings} and
|
* Merges the {@code Properties} configured in the {@code mappings} and
|
||||||
* {@code mappingLocations} into the final {@code Properties} instance
|
* {@code mappingLocations} into the final {@code Properties} instance
|
||||||
* used for {@code ObjectName} resolution.
|
* used for {@code ObjectName} resolution.
|
||||||
* @throws IOException
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void afterPropertiesSet() throws IOException {
|
public void afterPropertiesSet() throws IOException {
|
||||||
this.mergedMappings = new Properties();
|
this.mergedMappings = new Properties();
|
||||||
|
|
||||||
CollectionUtils.mergePropertiesIntoMap(this.mappings, this.mergedMappings);
|
CollectionUtils.mergePropertiesIntoMap(this.mappings, this.mergedMappings);
|
||||||
|
|
||||||
if (this.mappingLocations != null) {
|
if (this.mappingLocations != null) {
|
||||||
for (int i = 0; i < this.mappingLocations.length; i++) {
|
for (Resource location : this.mappingLocations) {
|
||||||
Resource location = this.mappingLocations[i];
|
|
||||||
if (logger.isInfoEnabled()) {
|
if (logger.isInfoEnabled()) {
|
||||||
logger.info("Loading JMX object name mappings file from " + location);
|
logger.info("Loading JMX object name mappings file from " + location);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2011 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -18,18 +18,19 @@ package org.springframework.jmx.support;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents how the measurement values of a {@code ManagedMetric} will change over time.
|
* Represents how the measurement values of a {@code ManagedMetric} will change over time.
|
||||||
|
*
|
||||||
* @author Jennifer Hickey
|
* @author Jennifer Hickey
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public enum MetricType {
|
public enum MetricType {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The measurement values may go up or down over time
|
* The measurement values may go up or down over time.
|
||||||
*/
|
*/
|
||||||
GAUGE,
|
GAUGE,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The measurement values will always increase
|
* The measurement values will always increase.
|
||||||
*/
|
*/
|
||||||
COUNTER
|
COUNTER
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2012 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -73,7 +73,7 @@ public class NotificationListenerHolder {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the {@link javax.management.NotificationFilter} associated
|
* Return the {@link javax.management.NotificationFilter} associated
|
||||||
* with the encapsulated {@link #getNotificationFilter() NotificationFilter}.
|
* with the encapsulated {@link #getNotificationListener() NotificationListener}.
|
||||||
* <p>May be {@code null}.
|
* <p>May be {@code null}.
|
||||||
*/
|
*/
|
||||||
public NotificationFilter getNotificationFilter() {
|
public NotificationFilter getNotificationFilter() {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2013 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -154,7 +154,7 @@ public class ConcurrentTaskScheduler extends ConcurrentTaskExecutor implements T
|
||||||
* Provide an {@link ErrorHandler} strategy.
|
* Provide an {@link ErrorHandler} strategy.
|
||||||
*/
|
*/
|
||||||
public void setErrorHandler(ErrorHandler errorHandler) {
|
public void setErrorHandler(ErrorHandler errorHandler) {
|
||||||
Assert.notNull(errorHandler, "'errorHandler' must not be null");
|
Assert.notNull(errorHandler, "ErrorHandler must not be null");
|
||||||
this.errorHandler = errorHandler;
|
this.errorHandler = errorHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -166,7 +166,8 @@ public class ConcurrentTaskScheduler extends ConcurrentTaskExecutor implements T
|
||||||
return new EnterpriseConcurrentTriggerScheduler().schedule(decorateTask(task, true), trigger);
|
return new EnterpriseConcurrentTriggerScheduler().schedule(decorateTask(task, true), trigger);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ErrorHandler errorHandler = (this.errorHandler != null ? this.errorHandler : TaskUtils.getDefaultErrorHandler(true));
|
ErrorHandler errorHandler =
|
||||||
|
(this.errorHandler != null ? this.errorHandler : TaskUtils.getDefaultErrorHandler(true));
|
||||||
return new ReschedulingRunnable(task, trigger, this.scheduledExecutor, errorHandler).schedule();
|
return new ReschedulingRunnable(task, trigger, this.scheduledExecutor, errorHandler).schedule();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -248,9 +249,9 @@ public class ConcurrentTaskScheduler extends ConcurrentTaskExecutor implements T
|
||||||
return executor.schedule(task, new javax.enterprise.concurrent.Trigger() {
|
return executor.schedule(task, new javax.enterprise.concurrent.Trigger() {
|
||||||
@Override
|
@Override
|
||||||
public Date getNextRunTime(LastExecution le, Date taskScheduledTime) {
|
public Date getNextRunTime(LastExecution le, Date taskScheduledTime) {
|
||||||
return trigger.nextExecutionTime(le != null ?
|
return (trigger.nextExecutionTime(le != null ?
|
||||||
new SimpleTriggerContext(le.getScheduledStart(), le.getRunStart(), le.getRunEnd()) :
|
new SimpleTriggerContext(le.getScheduledStart(), le.getRunStart(), le.getRunEnd()) :
|
||||||
new SimpleTriggerContext());
|
new SimpleTriggerContext()));
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public boolean skipRun(LastExecution lastExecution, Date scheduledRunTime) {
|
public boolean skipRun(LastExecution lastExecution, Date scheduledRunTime) {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2013 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -196,29 +196,30 @@ public abstract class ExecutorConfigurationSupport extends CustomizableThreadFac
|
||||||
* Perform a shutdown on the underlying ExecutorService.
|
* Perform a shutdown on the underlying ExecutorService.
|
||||||
* @see java.util.concurrent.ExecutorService#shutdown()
|
* @see java.util.concurrent.ExecutorService#shutdown()
|
||||||
* @see java.util.concurrent.ExecutorService#shutdownNow()
|
* @see java.util.concurrent.ExecutorService#shutdownNow()
|
||||||
* @see #awaitTerminationIfNecessary()
|
|
||||||
*/
|
*/
|
||||||
public void shutdown() {
|
public void shutdown() {
|
||||||
if (logger.isInfoEnabled()) {
|
if (logger.isInfoEnabled()) {
|
||||||
logger.info("Shutting down ExecutorService" + (this.beanName != null ? " '" + this.beanName + "'" : ""));
|
logger.info("Shutting down ExecutorService" + (this.beanName != null ? " '" + this.beanName + "'" : ""));
|
||||||
}
|
}
|
||||||
if (this.waitForTasksToCompleteOnShutdown) {
|
if (this.executor != null) {
|
||||||
this.executor.shutdown();
|
if (this.waitForTasksToCompleteOnShutdown) {
|
||||||
|
this.executor.shutdown();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.executor.shutdownNow();
|
||||||
|
}
|
||||||
|
awaitTerminationIfNecessary(this.executor);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
this.executor.shutdownNow();
|
|
||||||
}
|
|
||||||
awaitTerminationIfNecessary();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wait for the executor to terminate, according to the value of the
|
* Wait for the executor to terminate, according to the value of the
|
||||||
* {@link #setAwaitTerminationSeconds "awaitTerminationSeconds"} property.
|
* {@link #setAwaitTerminationSeconds "awaitTerminationSeconds"} property.
|
||||||
*/
|
*/
|
||||||
private void awaitTerminationIfNecessary() {
|
private void awaitTerminationIfNecessary(ExecutorService executor) {
|
||||||
if (this.awaitTerminationSeconds > 0) {
|
if (this.awaitTerminationSeconds > 0) {
|
||||||
try {
|
try {
|
||||||
if (!this.executor.awaitTermination(this.awaitTerminationSeconds, TimeUnit.SECONDS)) {
|
if (!executor.awaitTermination(this.awaitTerminationSeconds, TimeUnit.SECONDS)) {
|
||||||
if (logger.isWarnEnabled()) {
|
if (logger.isWarnEnabled()) {
|
||||||
logger.warn("Timed out while waiting for executor" +
|
logger.warn("Timed out while waiting for executor" +
|
||||||
(this.beanName != null ? " '" + this.beanName + "'" : "") + " to terminate");
|
(this.beanName != null ? " '" + this.beanName + "'" : "") + " to terminate");
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2014 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -67,10 +67,10 @@ public class ThreadPoolTaskScheduler extends ExecutorConfigurationSupport
|
||||||
|
|
||||||
private volatile boolean removeOnCancelPolicy = false;
|
private volatile boolean removeOnCancelPolicy = false;
|
||||||
|
|
||||||
private volatile ScheduledExecutorService scheduledExecutor;
|
|
||||||
|
|
||||||
private volatile ErrorHandler errorHandler;
|
private volatile ErrorHandler errorHandler;
|
||||||
|
|
||||||
|
private volatile ScheduledExecutorService scheduledExecutor;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the ScheduledExecutorService's pool size.
|
* Set the ScheduledExecutorService's pool size.
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2013 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -116,7 +116,8 @@ public class PeriodicTrigger implements Trigger {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PeriodicTrigger other = (PeriodicTrigger) obj;
|
PeriodicTrigger other = (PeriodicTrigger) obj;
|
||||||
return (this.fixedRate == other.fixedRate && this.initialDelay == other.initialDelay && this.period == other.period);
|
return (this.fixedRate == other.fixedRate && this.initialDelay == other.initialDelay &&
|
||||||
|
this.period == other.period);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -271,8 +271,8 @@ public class ScriptFactoryPostProcessor extends InstantiationAwareBeanPostProces
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
if (ex instanceof BeanCreationException
|
if (ex instanceof BeanCreationException &&
|
||||||
&& ((BeanCreationException) ex).getMostSpecificCause() instanceof BeanCurrentlyInCreationException) {
|
((BeanCreationException) ex).getMostSpecificCause() instanceof BeanCurrentlyInCreationException) {
|
||||||
if (logger.isTraceEnabled()) {
|
if (logger.isTraceEnabled()) {
|
||||||
logger.trace("Could not determine scripted object type for bean '" + beanName + "': "
|
logger.trace("Could not determine scripted object type for bean '" + beanName + "': "
|
||||||
+ ex.getMessage());
|
+ ex.getMessage());
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2012 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -112,6 +112,14 @@ public class DefaultMessageCodesResolver implements MessageCodesResolver, Serial
|
||||||
this.prefix = (prefix != null ? prefix : "");
|
this.prefix = (prefix != null ? prefix : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the prefix to be applied to any code built by this resolver.
|
||||||
|
* <p>Returns an empty String in case of no prefix.
|
||||||
|
*/
|
||||||
|
protected String getPrefix() {
|
||||||
|
return this.prefix;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specify the format for message codes built by this resolver.
|
* Specify the format for message codes built by this resolver.
|
||||||
* <p>The default is {@link Format#PREFIX_ERROR_CODE}.
|
* <p>The default is {@link Format#PREFIX_ERROR_CODE}.
|
||||||
|
|
@ -119,15 +127,7 @@ public class DefaultMessageCodesResolver implements MessageCodesResolver, Serial
|
||||||
* @see Format
|
* @see Format
|
||||||
*/
|
*/
|
||||||
public void setMessageCodeFormatter(MessageCodeFormatter formatter) {
|
public void setMessageCodeFormatter(MessageCodeFormatter formatter) {
|
||||||
this.formatter = (formatter == null ? DEFAULT_FORMATTER : formatter);
|
this.formatter = (formatter != null ? formatter : DEFAULT_FORMATTER);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the prefix to be applied to any code built by this resolver.
|
|
||||||
* <p>Returns an empty String in case of no prefix.
|
|
||||||
*/
|
|
||||||
protected String getPrefix() {
|
|
||||||
return this.prefix;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -141,7 +141,7 @@ public class DefaultMessageCodesResolver implements MessageCodesResolver, Serial
|
||||||
* object/field-specific code, a field-specific code, a plain error code.
|
* object/field-specific code, a field-specific code, a plain error code.
|
||||||
* <p>Arrays, Lists and Maps are resolved both for specific elements and
|
* <p>Arrays, Lists and Maps are resolved both for specific elements and
|
||||||
* the whole collection.
|
* the whole collection.
|
||||||
* <p>See the {@link DefaultMessageCodesResolver class level Javadoc} for
|
* <p>See the {@link DefaultMessageCodesResolver class level javadoc} for
|
||||||
* details on the generated codes.
|
* details on the generated codes.
|
||||||
* @return the list of codes
|
* @return the list of codes
|
||||||
*/
|
*/
|
||||||
|
|
@ -208,14 +208,10 @@ public class DefaultMessageCodesResolver implements MessageCodesResolver, Serial
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Common message code formats.
|
* Common message code formats.
|
||||||
*
|
|
||||||
* @author Phillip Webb
|
|
||||||
* @author Chris Beams
|
|
||||||
* @since 3.2
|
|
||||||
* @see MessageCodeFormatter
|
* @see MessageCodeFormatter
|
||||||
* @see DefaultMessageCodesResolver#setMessageCodeFormatter(MessageCodeFormatter)
|
* @see DefaultMessageCodesResolver#setMessageCodeFormatter(MessageCodeFormatter)
|
||||||
*/
|
*/
|
||||||
public static enum Format implements MessageCodeFormatter {
|
public enum Format implements MessageCodeFormatter {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prefix the error code at the beginning of the generated message code. e.g.:
|
* Prefix the error code at the beginning of the generated message code. e.g.:
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -62,8 +62,7 @@ public class FieldError extends ObjectError {
|
||||||
* @param arguments the array of arguments to be used to resolve this message
|
* @param arguments the array of arguments to be used to resolve this message
|
||||||
* @param defaultMessage the default message to be used to resolve this message
|
* @param defaultMessage the default message to be used to resolve this message
|
||||||
*/
|
*/
|
||||||
public FieldError(
|
public FieldError(String objectName, String field, Object rejectedValue, boolean bindingFailure,
|
||||||
String objectName, String field, Object rejectedValue, boolean bindingFailure,
|
|
||||||
String[] codes, Object[] arguments, String defaultMessage) {
|
String[] codes, Object[] arguments, String defaultMessage) {
|
||||||
|
|
||||||
super(objectName, codes, arguments, defaultMessage);
|
super(objectName, codes, arguments, defaultMessage);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -27,9 +27,9 @@ import org.springframework.util.Assert;
|
||||||
* how a message code list is built for an {@code ObjectError}.
|
* how a message code list is built for an {@code ObjectError}.
|
||||||
*
|
*
|
||||||
* @author Juergen Hoeller
|
* @author Juergen Hoeller
|
||||||
|
* @since 10.03.2003
|
||||||
* @see FieldError
|
* @see FieldError
|
||||||
* @see DefaultMessageCodesResolver
|
* @see DefaultMessageCodesResolver
|
||||||
* @since 10.03.2003
|
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class ObjectError extends DefaultMessageSourceResolvable {
|
public class ObjectError extends DefaultMessageSourceResolvable {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -75,7 +75,7 @@ public final class MethodClassKey implements Comparable<MethodClassKey> {
|
||||||
int result = this.method.getName().compareTo(other.method.getName());
|
int result = this.method.getName().compareTo(other.method.getName());
|
||||||
if (result == 0) {
|
if (result == 0) {
|
||||||
result = this.method.toString().compareTo(other.method.toString());
|
result = this.method.toString().compareTo(other.method.toString());
|
||||||
if (result == 0 && this.targetClass != null) {
|
if (result == 0 && this.targetClass != null && other.targetClass != null) {
|
||||||
result = this.targetClass.getName().compareTo(other.targetClass.getName());
|
result = this.targetClass.getName().compareTo(other.targetClass.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2015 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -24,7 +24,7 @@ package org.springframework.core;
|
||||||
*
|
*
|
||||||
* <p>Users of this interface should be careful in complex hierarchy scenarios, especially
|
* <p>Users of this interface should be careful in complex hierarchy scenarios, especially
|
||||||
* when the generic type signature of the class changes in sub-classes. It is always
|
* when the generic type signature of the class changes in sub-classes. It is always
|
||||||
* possible to return {@code null} to fallback on a default behaviour.
|
* possible to return {@code null} to fallback on a default behavior.
|
||||||
*
|
*
|
||||||
* @author Stephane Nicoll
|
* @author Stephane Nicoll
|
||||||
* @since 4.2
|
* @since 4.2
|
||||||
|
|
|
||||||
|
|
@ -35,19 +35,19 @@ import org.springframework.util.ConcurrentReferenceHashMap;
|
||||||
import org.springframework.util.ReflectionUtils;
|
import org.springframework.util.ReflectionUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal utility class that can be used to obtain wrapped {@link Serializable} variants
|
* Internal utility class that can be used to obtain wrapped {@link Serializable}
|
||||||
* of {@link java.lang.reflect.Type}s.
|
* variants of {@link java.lang.reflect.Type}s.
|
||||||
*
|
*
|
||||||
* <p>{@link #forField(Field) Fields} or {@link #forMethodParameter(MethodParameter)
|
* <p>{@link #forField(Field) Fields} or {@link #forMethodParameter(MethodParameter)
|
||||||
* MethodParameters} can be used as the root source for a serializable type. Alternatively
|
* MethodParameters} can be used as the root source for a serializable type.
|
||||||
* the {@link #forGenericSuperclass(Class) superclass},
|
* Alternatively the {@link #forGenericSuperclass(Class) superclass},
|
||||||
* {@link #forGenericInterfaces(Class) interfaces} or {@link #forTypeParameters(Class)
|
* {@link #forGenericInterfaces(Class) interfaces} or {@link #forTypeParameters(Class)
|
||||||
* type parameters} or a regular {@link Class} can also be used as source.
|
* type parameters} or a regular {@link Class} can also be used as source.
|
||||||
*
|
*
|
||||||
* <p>The returned type will either be a {@link Class} or a serializable proxy of
|
* <p>The returned type will either be a {@link Class} or a serializable proxy of
|
||||||
* {@link GenericArrayType}, {@link ParameterizedType}, {@link TypeVariable} or
|
* {@link GenericArrayType}, {@link ParameterizedType}, {@link TypeVariable} or
|
||||||
* {@link WildcardType}. With the exception of {@link Class} (which is final) calls to
|
* {@link WildcardType}. With the exception of {@link Class} (which is final) calls
|
||||||
* methods that return further {@link Type}s (for example
|
* to methods that return further {@link Type}s (for example
|
||||||
* {@link GenericArrayType#getGenericComponentType()}) will be automatically wrapped.
|
* {@link GenericArrayType#getGenericComponentType()}) will be automatically wrapped.
|
||||||
*
|
*
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
|
|
|
||||||
|
|
@ -1441,8 +1441,8 @@ public class AnnotatedElementUtils {
|
||||||
* <p>If this method returns {@code true}, then {@link #getAggregatedResults()}
|
* <p>If this method returns {@code true}, then {@link #getAggregatedResults()}
|
||||||
* must return a non-null value.
|
* must return a non-null value.
|
||||||
* @return {@code true} if this processor supports aggregated results
|
* @return {@code true} if this processor supports aggregated results
|
||||||
* @see #getAggregatedResults
|
|
||||||
* @since 4.3
|
* @since 4.3
|
||||||
|
* @see #getAggregatedResults
|
||||||
*/
|
*/
|
||||||
boolean aggregates();
|
boolean aggregates();
|
||||||
|
|
||||||
|
|
@ -1453,10 +1453,9 @@ public class AnnotatedElementUtils {
|
||||||
* responsible for asking this processor if it {@link #aggregates} results
|
* responsible for asking this processor if it {@link #aggregates} results
|
||||||
* and then adding the post-processed results to the list returned by this
|
* and then adding the post-processed results to the list returned by this
|
||||||
* method.
|
* method.
|
||||||
* @return the list of results aggregated by this processor
|
* @return the list of results aggregated by this processor (never {@code null})
|
||||||
* (never {@code null} unless {@link #aggregates} returns {@code false})
|
|
||||||
* @see #aggregates
|
|
||||||
* @since 4.3
|
* @since 4.3
|
||||||
|
* @see #aggregates
|
||||||
*/
|
*/
|
||||||
List<T> getAggregatedResults();
|
List<T> getAggregatedResults();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -243,10 +243,9 @@ public class AnnotationAttributes extends LinkedHashMap<String, Object> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the value stored under the specified {@code attributeName} as a
|
* Get the value stored under the specified {@code attributeName} as a boolean.
|
||||||
* boolean.
|
* @param attributeName the name of the attribute to get;
|
||||||
* @param attributeName the name of the attribute to get; never
|
* never {@code null} or empty
|
||||||
* {@code null} or empty
|
|
||||||
* @return the value
|
* @return the value
|
||||||
* @throws IllegalArgumentException if the attribute does not exist or
|
* @throws IllegalArgumentException if the attribute does not exist or
|
||||||
* if it is not of the expected type
|
* if it is not of the expected type
|
||||||
|
|
@ -256,10 +255,9 @@ public class AnnotationAttributes extends LinkedHashMap<String, Object> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the value stored under the specified {@code attributeName} as a
|
* Get the value stored under the specified {@code attributeName} as a number.
|
||||||
* number.
|
* @param attributeName the name of the attribute to get;
|
||||||
* @param attributeName the name of the attribute to get; never
|
* never {@code null} or empty
|
||||||
* {@code null} or empty
|
|
||||||
* @return the value
|
* @return the value
|
||||||
* @throws IllegalArgumentException if the attribute does not exist or
|
* @throws IllegalArgumentException if the attribute does not exist or
|
||||||
* if it is not of the expected type
|
* if it is not of the expected type
|
||||||
|
|
@ -270,10 +268,9 @@ public class AnnotationAttributes extends LinkedHashMap<String, Object> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the value stored under the specified {@code attributeName} as an
|
* Get the value stored under the specified {@code attributeName} as an enum.
|
||||||
* enum.
|
* @param attributeName the name of the attribute to get;
|
||||||
* @param attributeName the name of the attribute to get; never
|
* never {@code null} or empty
|
||||||
* {@code null} or empty
|
|
||||||
* @return the value
|
* @return the value
|
||||||
* @throws IllegalArgumentException if the attribute does not exist or
|
* @throws IllegalArgumentException if the attribute does not exist or
|
||||||
* if it is not of the expected type
|
* if it is not of the expected type
|
||||||
|
|
@ -284,10 +281,9 @@ public class AnnotationAttributes extends LinkedHashMap<String, Object> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the value stored under the specified {@code attributeName} as a
|
* Get the value stored under the specified {@code attributeName} as a class.
|
||||||
* class.
|
* @param attributeName the name of the attribute to get;
|
||||||
* @param attributeName the name of the attribute to get; never
|
* never {@code null} or empty
|
||||||
* {@code null} or empty
|
|
||||||
* @return the value
|
* @return the value
|
||||||
* @throws IllegalArgumentException if the attribute does not exist or
|
* @throws IllegalArgumentException if the attribute does not exist or
|
||||||
* if it is not of the expected type
|
* if it is not of the expected type
|
||||||
|
|
@ -300,11 +296,10 @@ public class AnnotationAttributes extends LinkedHashMap<String, Object> {
|
||||||
/**
|
/**
|
||||||
* Get the value stored under the specified {@code attributeName} as an
|
* Get the value stored under the specified {@code attributeName} as an
|
||||||
* array of classes.
|
* array of classes.
|
||||||
* <p>If the value stored under the specified {@code attributeName} is
|
* <p>If the value stored under the specified {@code attributeName} is a class,
|
||||||
* a class, it will be wrapped in a single-element array before
|
* it will be wrapped in a single-element array before returning it.
|
||||||
* returning it.
|
* @param attributeName the name of the attribute to get;
|
||||||
* @param attributeName the name of the attribute to get; never
|
* never {@code null} or empty
|
||||||
* {@code null} or empty
|
|
||||||
* @return the value
|
* @return the value
|
||||||
* @throws IllegalArgumentException if the attribute does not exist or
|
* @throws IllegalArgumentException if the attribute does not exist or
|
||||||
* if it is not of the expected type
|
* if it is not of the expected type
|
||||||
|
|
@ -361,8 +356,8 @@ public class AnnotationAttributes extends LinkedHashMap<String, Object> {
|
||||||
/**
|
/**
|
||||||
* Get the annotation of type {@code annotationType} stored under the
|
* Get the annotation of type {@code annotationType} stored under the
|
||||||
* specified {@code attributeName}.
|
* specified {@code attributeName}.
|
||||||
* @param attributeName the name of the attribute to get; never
|
* @param attributeName the name of the attribute to get;
|
||||||
* {@code null} or empty
|
* never {@code null} or empty
|
||||||
* @param annotationType the expected annotation type; never {@code null}
|
* @param annotationType the expected annotation type; never {@code null}
|
||||||
* @return the annotation
|
* @return the annotation
|
||||||
* @throws IllegalArgumentException if the attribute does not exist or
|
* @throws IllegalArgumentException if the attribute does not exist or
|
||||||
|
|
@ -381,8 +376,8 @@ public class AnnotationAttributes extends LinkedHashMap<String, Object> {
|
||||||
* a single-element array before returning it.
|
* a single-element array before returning it.
|
||||||
* <p>Note: if you expect an actual array of annotations, invoke
|
* <p>Note: if you expect an actual array of annotations, invoke
|
||||||
* {@link #getAnnotationArray(String, Class)} instead.
|
* {@link #getAnnotationArray(String, Class)} instead.
|
||||||
* @param attributeName the name of the attribute to get; never
|
* @param attributeName the name of the attribute to get;
|
||||||
* {@code null} or empty
|
* never {@code null} or empty
|
||||||
* @return the array of {@code AnnotationAttributes}
|
* @return the array of {@code AnnotationAttributes}
|
||||||
* @throws IllegalArgumentException if the attribute does not exist or
|
* @throws IllegalArgumentException if the attribute does not exist or
|
||||||
* if it is not of the expected type
|
* if it is not of the expected type
|
||||||
|
|
@ -397,8 +392,8 @@ public class AnnotationAttributes extends LinkedHashMap<String, Object> {
|
||||||
* <p>If the value stored under the specified {@code attributeName} is
|
* <p>If the value stored under the specified {@code attributeName} is
|
||||||
* an {@code Annotation}, it will be wrapped in a single-element array
|
* an {@code Annotation}, it will be wrapped in a single-element array
|
||||||
* before returning it.
|
* before returning it.
|
||||||
* @param attributeName the name of the attribute to get; never
|
* @param attributeName the name of the attribute to get;
|
||||||
* {@code null} or empty
|
* never {@code null} or empty
|
||||||
* @param annotationType the expected annotation type; never {@code null}
|
* @param annotationType the expected annotation type; never {@code null}
|
||||||
* @return the annotation array
|
* @return the annotation array
|
||||||
* @throws IllegalArgumentException if the attribute does not exist or
|
* @throws IllegalArgumentException if the attribute does not exist or
|
||||||
|
|
@ -419,8 +414,8 @@ public class AnnotationAttributes extends LinkedHashMap<String, Object> {
|
||||||
* component type of the expected array type, the single element will be
|
* component type of the expected array type, the single element will be
|
||||||
* wrapped in a single-element array of the appropriate type before
|
* wrapped in a single-element array of the appropriate type before
|
||||||
* returning it.
|
* returning it.
|
||||||
* @param attributeName the name of the attribute to get; never
|
* @param attributeName the name of the attribute to get;
|
||||||
* {@code null} or empty
|
* never {@code null} or empty
|
||||||
* @param expectedType the expected type; never {@code null}
|
* @param expectedType the expected type; never {@code null}
|
||||||
* @return the value
|
* @return the value
|
||||||
* @throws IllegalArgumentException if the attribute does not exist or
|
* @throws IllegalArgumentException if the attribute does not exist or
|
||||||
|
|
|
||||||
|
|
@ -207,8 +207,8 @@ public final class Property {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addAnnotationsToMap(
|
private void addAnnotationsToMap(
|
||||||
Map<Class<? extends Annotation>, Annotation> annotationMap,
|
Map<Class<? extends Annotation>, Annotation> annotationMap, AnnotatedElement object) {
|
||||||
AnnotatedElement object) {
|
|
||||||
if (object != null) {
|
if (object != null) {
|
||||||
for (Annotation annotation : object.getAnnotations()) {
|
for (Annotation annotation : object.getAnnotations()) {
|
||||||
annotationMap.put(annotation.annotationType(), annotation);
|
annotationMap.put(annotation.annotationType(), annotation);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2015 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -112,6 +112,10 @@ final class ByteBufferConverter implements ConditionalGenericConverter {
|
||||||
byte[] bytes = (byte[]) (source instanceof byte[] ? source :
|
byte[] bytes = (byte[]) (source instanceof byte[] ? source :
|
||||||
this.conversionService.convert(source, sourceType, BYTE_ARRAY_TYPE));
|
this.conversionService.convert(source, sourceType, BYTE_ARRAY_TYPE));
|
||||||
|
|
||||||
|
if (bytes == null) {
|
||||||
|
return ByteBuffer.wrap(new byte[0]);
|
||||||
|
}
|
||||||
|
|
||||||
ByteBuffer byteBuffer = ByteBuffer.allocate(bytes.length);
|
ByteBuffer byteBuffer = ByteBuffer.allocate(bytes.length);
|
||||||
byteBuffer.put(bytes);
|
byteBuffer.put(bytes);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2012 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -40,10 +40,12 @@ final class CollectionToArrayConverter implements ConditionalGenericConverter {
|
||||||
|
|
||||||
private final ConversionService conversionService;
|
private final ConversionService conversionService;
|
||||||
|
|
||||||
|
|
||||||
public CollectionToArrayConverter(ConversionService conversionService) {
|
public CollectionToArrayConverter(ConversionService conversionService) {
|
||||||
this.conversionService = conversionService;
|
this.conversionService = conversionService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<ConvertiblePair> getConvertibleTypes() {
|
public Set<ConvertiblePair> getConvertibleTypes() {
|
||||||
return Collections.singleton(new ConvertiblePair(Collection.class, Object[].class));
|
return Collections.singleton(new ConvertiblePair(Collection.class, Object[].class));
|
||||||
|
|
@ -51,7 +53,8 @@ final class CollectionToArrayConverter implements ConditionalGenericConverter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) {
|
public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||||
return ConversionUtils.canConvertElements(sourceType.getElementTypeDescriptor(), targetType.getElementTypeDescriptor(), this.conversionService);
|
return ConversionUtils.canConvertElements(sourceType.getElementTypeDescriptor(),
|
||||||
|
targetType.getElementTypeDescriptor(), this.conversionService);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -63,7 +66,8 @@ final class CollectionToArrayConverter implements ConditionalGenericConverter {
|
||||||
Object array = Array.newInstance(targetType.getElementTypeDescriptor().getType(), sourceCollection.size());
|
Object array = Array.newInstance(targetType.getElementTypeDescriptor().getType(), sourceCollection.size());
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (Object sourceElement : sourceCollection) {
|
for (Object sourceElement : sourceCollection) {
|
||||||
Object targetElement = this.conversionService.convert(sourceElement, sourceType.elementTypeDescriptor(sourceElement), targetType.getElementTypeDescriptor());
|
Object targetElement = this.conversionService.convert( sourceElement,
|
||||||
|
sourceType.elementTypeDescriptor(sourceElement), targetType.getElementTypeDescriptor());
|
||||||
Array.set(array, i++, targetElement);
|
Array.set(array, i++, targetElement);
|
||||||
}
|
}
|
||||||
return array;
|
return array;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2015 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -50,10 +50,9 @@ abstract class ReadOnlySystemAttributesMap implements Map<String, String> {
|
||||||
public String get(Object key) {
|
public String get(Object key) {
|
||||||
if (!(key instanceof String)) {
|
if (!(key instanceof String)) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"Type of key [" + (key != null ? key.getClass().getName() : "null") +
|
"Type of key [" + key.getClass().getName() + "] must be java.lang.String");
|
||||||
"] must be java.lang.String.");
|
|
||||||
}
|
}
|
||||||
return this.getSystemAttribute((String) key);
|
return getSystemAttribute((String) key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2015 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -21,6 +21,8 @@ import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link Resource} implementation for a given byte array.
|
* {@link Resource} implementation for a given byte array.
|
||||||
* <p>Creates a {@link ByteArrayInputStream} for the given byte array.
|
* <p>Creates a {@link ByteArrayInputStream} for the given byte array.
|
||||||
|
|
@ -58,9 +60,7 @@ public class ByteArrayResource extends AbstractResource {
|
||||||
* @param description where the byte array comes from
|
* @param description where the byte array comes from
|
||||||
*/
|
*/
|
||||||
public ByteArrayResource(byte[] byteArray, String description) {
|
public ByteArrayResource(byte[] byteArray, String description) {
|
||||||
if (byteArray == null) {
|
Assert.notNull(byteArray, "Byte array must not be null");
|
||||||
throw new IllegalArgumentException("Byte array must not be null");
|
|
||||||
}
|
|
||||||
this.byteArray = byteArray;
|
this.byteArray = byteArray;
|
||||||
this.description = (description != null ? description : "");
|
this.description = (description != null ? description : "");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2014 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -46,10 +46,10 @@ public abstract class VfsUtils {
|
||||||
private static final String VFS3_PKG = "org.jboss.vfs.";
|
private static final String VFS3_PKG = "org.jboss.vfs.";
|
||||||
private static final String VFS_NAME = "VFS";
|
private static final String VFS_NAME = "VFS";
|
||||||
|
|
||||||
private static Method VFS_METHOD_GET_ROOT_URL = null;
|
private static Method VFS_METHOD_GET_ROOT_URL;
|
||||||
private static Method VFS_METHOD_GET_ROOT_URI = null;
|
private static Method VFS_METHOD_GET_ROOT_URI;
|
||||||
|
|
||||||
private static Method VIRTUAL_FILE_METHOD_EXISTS = null;
|
private static Method VIRTUAL_FILE_METHOD_EXISTS;
|
||||||
private static Method VIRTUAL_FILE_METHOD_GET_INPUT_STREAM;
|
private static Method VIRTUAL_FILE_METHOD_GET_INPUT_STREAM;
|
||||||
private static Method VIRTUAL_FILE_METHOD_GET_SIZE;
|
private static Method VIRTUAL_FILE_METHOD_GET_SIZE;
|
||||||
private static Method VIRTUAL_FILE_METHOD_GET_LAST_MODIFIED;
|
private static Method VIRTUAL_FILE_METHOD_GET_LAST_MODIFIED;
|
||||||
|
|
@ -62,8 +62,8 @@ public abstract class VfsUtils {
|
||||||
protected static Class<?> VIRTUAL_FILE_VISITOR_INTERFACE;
|
protected static Class<?> VIRTUAL_FILE_VISITOR_INTERFACE;
|
||||||
protected static Method VIRTUAL_FILE_METHOD_VISIT;
|
protected static Method VIRTUAL_FILE_METHOD_VISIT;
|
||||||
|
|
||||||
private static Field VISITOR_ATTRIBUTES_FIELD_RECURSE = null;
|
private static Field VISITOR_ATTRIBUTES_FIELD_RECURSE;
|
||||||
private static Method GET_PHYSICAL_FILE = null;
|
private static Method GET_PHYSICAL_FILE;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
ClassLoader loader = VfsUtils.class.getClassLoader();
|
ClassLoader loader = VfsUtils.class.getClassLoader();
|
||||||
|
|
@ -90,7 +90,7 @@ public abstract class VfsUtils {
|
||||||
Class<?> visitorAttributesClass = loader.loadClass(VFS3_PKG + "VisitorAttributes");
|
Class<?> visitorAttributesClass = loader.loadClass(VFS3_PKG + "VisitorAttributes");
|
||||||
VISITOR_ATTRIBUTES_FIELD_RECURSE = ReflectionUtils.findField(visitorAttributesClass, "RECURSE");
|
VISITOR_ATTRIBUTES_FIELD_RECURSE = ReflectionUtils.findField(visitorAttributesClass, "RECURSE");
|
||||||
}
|
}
|
||||||
catch (ClassNotFoundException ex) {
|
catch (Throwable ex) {
|
||||||
throw new IllegalStateException("Could not detect JBoss VFS infrastructure", ex);
|
throw new IllegalStateException("Could not detect JBoss VFS infrastructure", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -404,12 +404,6 @@ public class FastByteArrayOutputStream extends OutputStream {
|
||||||
else if (len == 0) {
|
else if (len == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if (len < 0) {
|
|
||||||
throw new IllegalArgumentException("len must be 0 or greater: " + len);
|
|
||||||
}
|
|
||||||
else if (off < 0) {
|
|
||||||
throw new IllegalArgumentException("off must be 0 or greater: " + off);
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
if (this.currentBuffer == null) {
|
if (this.currentBuffer == null) {
|
||||||
// This stream doesn't have any data in it...
|
// This stream doesn't have any data in it...
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2013 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -122,8 +122,8 @@ public class MethodInvoker {
|
||||||
* Set arguments for the method invocation. If this property is not set,
|
* Set arguments for the method invocation. If this property is not set,
|
||||||
* or the Object array is of length 0, a method with no arguments is assumed.
|
* or the Object array is of length 0, a method with no arguments is assumed.
|
||||||
*/
|
*/
|
||||||
public void setArguments(Object[] arguments) {
|
public void setArguments(Object... arguments) {
|
||||||
this.arguments = (arguments != null ? arguments : new Object[0]);
|
this.arguments = arguments;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -156,12 +156,8 @@ public class MethodInvoker {
|
||||||
|
|
||||||
Class<?> targetClass = getTargetClass();
|
Class<?> targetClass = getTargetClass();
|
||||||
String targetMethod = getTargetMethod();
|
String targetMethod = getTargetMethod();
|
||||||
if (targetClass == null) {
|
Assert.notNull(targetClass, "Either 'targetClass' or 'targetObject' is required");
|
||||||
throw new IllegalArgumentException("Either 'targetClass' or 'targetObject' is required");
|
Assert.notNull(targetMethod, "Property 'targetMethod' is required");
|
||||||
}
|
|
||||||
if (targetMethod == null) {
|
|
||||||
throw new IllegalArgumentException("Property 'targetMethod' is required");
|
|
||||||
}
|
|
||||||
|
|
||||||
Object[] arguments = getArguments();
|
Object[] arguments = getArguments();
|
||||||
Class<?>[] argTypes = new Class<?>[arguments.length];
|
Class<?>[] argTypes = new Class<?>[arguments.length];
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -724,12 +724,8 @@ public abstract class ReflectionUtils {
|
||||||
* work on objects with public no-arg constructors.
|
* work on objects with public no-arg constructors.
|
||||||
*/
|
*/
|
||||||
public static void shallowCopyFieldState(final Object src, final Object dest) {
|
public static void shallowCopyFieldState(final Object src, final Object dest) {
|
||||||
if (src == null) {
|
Assert.notNull(src, "Source for field copy cannot be null");
|
||||||
throw new IllegalArgumentException("Source for field copy cannot be null");
|
Assert.notNull(dest, "Destination for field copy cannot be null");
|
||||||
}
|
|
||||||
if (dest == null) {
|
|
||||||
throw new IllegalArgumentException("Destination for field copy cannot be null");
|
|
||||||
}
|
|
||||||
if (!src.getClass().isAssignableFrom(dest.getClass())) {
|
if (!src.getClass().isAssignableFrom(dest.getClass())) {
|
||||||
throw new IllegalArgumentException("Destination class [" + dest.getClass().getName() +
|
throw new IllegalArgumentException("Destination class [" + dest.getClass().getName() +
|
||||||
"] must be same or subclass as source class [" + src.getClass().getName() + "]");
|
"] must be same or subclass as source class [" + src.getClass().getName() + "]");
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -215,7 +215,6 @@ public abstract class TypeUtils {
|
||||||
if (rhsType == null) {
|
if (rhsType == null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lhsType == null) {
|
if (lhsType == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -49,7 +49,7 @@ public abstract class FutureAdapter<T, S> implements Future<T> {
|
||||||
* @param adaptee the future to delegate to
|
* @param adaptee the future to delegate to
|
||||||
*/
|
*/
|
||||||
protected FutureAdapter(Future<S> adaptee) {
|
protected FutureAdapter(Future<S> adaptee) {
|
||||||
Assert.notNull(adaptee, "'delegate' must not be null");
|
Assert.notNull(adaptee, "Delegate must not be null");
|
||||||
this.adaptee = adaptee;
|
this.adaptee = adaptee;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2012 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -25,6 +25,14 @@ package org.springframework.expression;
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class AccessException extends Exception {
|
public class AccessException extends Exception {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an AccessException with a specific message.
|
||||||
|
* @param message the message
|
||||||
|
*/
|
||||||
|
public AccessException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an AccessException with a specific message and cause.
|
* Create an AccessException with a specific message and cause.
|
||||||
* @param message the message
|
* @param message the message
|
||||||
|
|
@ -34,12 +42,4 @@ public class AccessException extends Exception {
|
||||||
super(message, cause);
|
super(message, cause);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Create an AccessException with a specific message.
|
|
||||||
* @param message the message
|
|
||||||
*/
|
|
||||||
public AccessException(String message) {
|
|
||||||
super(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,13 +36,12 @@ public interface ConstructorExecutor {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute a constructor in the specified context using the specified arguments.
|
* Execute a constructor in the specified context using the specified arguments.
|
||||||
*
|
|
||||||
* @param context the evaluation context in which the command is being executed
|
* @param context the evaluation context in which the command is being executed
|
||||||
* @param arguments the arguments to the constructor call, should match (in terms of
|
* @param arguments the arguments to the constructor call, should match (in terms
|
||||||
* number and type) whatever the command will need to run
|
* of number and type) whatever the command will need to run
|
||||||
* @return the new object
|
* @return the new object
|
||||||
* @throws AccessException if there is a problem executing the command or the
|
* @throws AccessException if there is a problem executing the command or the
|
||||||
* CommandExecutor is no longer valid
|
* CommandExecutor is no longer valid
|
||||||
*/
|
*/
|
||||||
TypedValue execute(EvaluationContext context, Object... arguments) throws AccessException;
|
TypedValue execute(EvaluationContext context, Object... arguments) throws AccessException;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2013 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -17,9 +17,9 @@
|
||||||
package org.springframework.expression;
|
package org.springframework.expression;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* By default the mathematical operators {@link Operation} support simple types like
|
* By default the mathematical operators {@link Operation} support simple types
|
||||||
* numbers. By providing an implementation of OperatorOverloader, a user of the expression
|
* like numbers. By providing an implementation of OperatorOverloader, a user
|
||||||
* language can support these operations on other types.
|
* of the expression language can support these operations on other types.
|
||||||
*
|
*
|
||||||
* @author Andy Clement
|
* @author Andy Clement
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
|
|
@ -27,21 +27,21 @@ package org.springframework.expression;
|
||||||
public interface OperatorOverloader {
|
public interface OperatorOverloader {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return true if the operator overloader supports the specified operation between the
|
* Return true if the operator overloader supports the specified operation
|
||||||
* two operands and so should be invoked to handle it.
|
* between the two operands and so should be invoked to handle it.
|
||||||
* @param operation the operation to be performed
|
* @param operation the operation to be performed
|
||||||
* @param leftOperand the left operand
|
* @param leftOperand the left operand
|
||||||
* @param rightOperand the right operand
|
* @param rightOperand the right operand
|
||||||
* @return true if the OperatorOverloader supports the specified operation between the
|
* @return true if the OperatorOverloader supports the specified operation
|
||||||
* two operands
|
* between the two operands
|
||||||
* @throws EvaluationException if there is a problem performing the operation
|
* @throws EvaluationException if there is a problem performing the operation
|
||||||
*/
|
*/
|
||||||
boolean overridesOperation(Operation operation, Object leftOperand, Object rightOperand)
|
boolean overridesOperation(Operation operation, Object leftOperand, Object rightOperand)
|
||||||
throws EvaluationException;
|
throws EvaluationException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the specified operation on two operands, returning a result. See
|
* Execute the specified operation on two operands, returning a result.
|
||||||
* {@link Operation} for supported operations.
|
* See {@link Operation} for supported operations.
|
||||||
* @param operation the operation to be performed
|
* @param operation the operation to be performed
|
||||||
* @param leftOperand the left operand
|
* @param leftOperand the left operand
|
||||||
* @param rightOperand the right operand
|
* @param rightOperand the right operand
|
||||||
|
|
|
||||||
|
|
@ -112,6 +112,7 @@ public abstract class TemplateAwareExpressionParser implements ExpressionParser
|
||||||
String prefix = context.getExpressionPrefix();
|
String prefix = context.getExpressionPrefix();
|
||||||
String suffix = context.getExpressionSuffix();
|
String suffix = context.getExpressionSuffix();
|
||||||
int startIdx = 0;
|
int startIdx = 0;
|
||||||
|
|
||||||
while (startIdx < expressionString.length()) {
|
while (startIdx < expressionString.length()) {
|
||||||
int prefixIndex = expressionString.indexOf(prefix, startIdx);
|
int prefixIndex = expressionString.indexOf(prefix, startIdx);
|
||||||
if (prefixIndex >= startIdx) {
|
if (prefixIndex >= startIdx) {
|
||||||
|
|
@ -126,22 +127,18 @@ public abstract class TemplateAwareExpressionParser implements ExpressionParser
|
||||||
"No ending suffix '" + suffix + "' for expression starting at character " +
|
"No ending suffix '" + suffix + "' for expression starting at character " +
|
||||||
prefixIndex + ": " + expressionString.substring(prefixIndex));
|
prefixIndex + ": " + expressionString.substring(prefixIndex));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (suffixIndex == afterPrefixIndex) {
|
if (suffixIndex == afterPrefixIndex) {
|
||||||
throw new ParseException(expressionString, prefixIndex,
|
throw new ParseException(expressionString, prefixIndex,
|
||||||
"No expression defined within delimiter '" + prefix + suffix +
|
"No expression defined within delimiter '" + prefix + suffix +
|
||||||
"' at character " + prefixIndex);
|
"' at character " + prefixIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
String expr = expressionString.substring(prefixIndex + prefix.length(), suffixIndex);
|
String expr = expressionString.substring(prefixIndex + prefix.length(), suffixIndex);
|
||||||
expr = expr.trim();
|
expr = expr.trim();
|
||||||
|
|
||||||
if (expr.isEmpty()) {
|
if (expr.isEmpty()) {
|
||||||
throw new ParseException(expressionString, prefixIndex,
|
throw new ParseException(expressionString, prefixIndex,
|
||||||
"No expression defined within delimiter '" + prefix + suffix +
|
"No expression defined within delimiter '" + prefix + suffix +
|
||||||
"' at character " + prefixIndex);
|
"' at character " + prefixIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
expressions.add(doParseExpression(expr, context));
|
expressions.add(doParseExpression(expr, context));
|
||||||
startIdx = suffixIndex + suffix.length();
|
startIdx = suffixIndex + suffix.length();
|
||||||
}
|
}
|
||||||
|
|
@ -151,6 +148,7 @@ public abstract class TemplateAwareExpressionParser implements ExpressionParser
|
||||||
startIdx = expressionString.length();
|
startIdx = expressionString.length();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return expressions.toArray(new Expression[expressions.size()]);
|
return expressions.toArray(new Expression[expressions.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2015 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -32,6 +32,7 @@ import org.springframework.expression.TypeComparator;
|
||||||
import org.springframework.expression.TypeConverter;
|
import org.springframework.expression.TypeConverter;
|
||||||
import org.springframework.expression.TypedValue;
|
import org.springframework.expression.TypedValue;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An ExpressionState is for maintaining per-expression-evaluation state, any changes to
|
* An ExpressionState is for maintaining per-expression-evaluation state, any changes to
|
||||||
|
|
@ -53,6 +54,12 @@ public class ExpressionState {
|
||||||
|
|
||||||
private final TypedValue rootObject;
|
private final TypedValue rootObject;
|
||||||
|
|
||||||
|
private final SpelParserConfiguration configuration;
|
||||||
|
|
||||||
|
private Stack<TypedValue> contextObjects;
|
||||||
|
|
||||||
|
private Stack<VariableScope> variableScopes;
|
||||||
|
|
||||||
// When entering a new scope there is a new base object which should be used
|
// When entering a new scope there is a new base object which should be used
|
||||||
// for '#this' references (or to act as a target for unqualified references).
|
// for '#this' references (or to act as a target for unqualified references).
|
||||||
// This stack captures those objects at each nested scope level.
|
// This stack captures those objects at each nested scope level.
|
||||||
|
|
@ -62,12 +69,6 @@ public class ExpressionState {
|
||||||
// element from list1
|
// element from list1
|
||||||
private Stack<TypedValue> scopeRootObjects;
|
private Stack<TypedValue> scopeRootObjects;
|
||||||
|
|
||||||
private final SpelParserConfiguration configuration;
|
|
||||||
|
|
||||||
private Stack<VariableScope> variableScopes;
|
|
||||||
|
|
||||||
private Stack<TypedValue> contextObjects;
|
|
||||||
|
|
||||||
|
|
||||||
public ExpressionState(EvaluationContext context) {
|
public ExpressionState(EvaluationContext context) {
|
||||||
this(context, context.getRootObject(), new SpelParserConfiguration(false, false));
|
this(context, context.getRootObject(), new SpelParserConfiguration(false, false));
|
||||||
|
|
@ -105,7 +106,7 @@ public class ExpressionState {
|
||||||
* The active context object is what unqualified references to properties/etc are resolved against.
|
* The active context object is what unqualified references to properties/etc are resolved against.
|
||||||
*/
|
*/
|
||||||
public TypedValue getActiveContextObject() {
|
public TypedValue getActiveContextObject() {
|
||||||
if (this.contextObjects == null || this.contextObjects.isEmpty()) {
|
if (CollectionUtils.isEmpty(this.contextObjects)) {
|
||||||
return this.rootObject;
|
return this.rootObject;
|
||||||
}
|
}
|
||||||
return this.contextObjects.peek();
|
return this.contextObjects.peek();
|
||||||
|
|
@ -130,7 +131,7 @@ public class ExpressionState {
|
||||||
}
|
}
|
||||||
|
|
||||||
public TypedValue getScopeRootContextObject() {
|
public TypedValue getScopeRootContextObject() {
|
||||||
if (this.scopeRootObjects == null || this.scopeRootObjects.isEmpty()) {
|
if (CollectionUtils.isEmpty(this.scopeRootObjects)) {
|
||||||
return this.rootObject;
|
return this.rootObject;
|
||||||
}
|
}
|
||||||
return this.scopeRootObjects.peek();
|
return this.scopeRootObjects.peek();
|
||||||
|
|
@ -142,12 +143,7 @@ public class ExpressionState {
|
||||||
|
|
||||||
public TypedValue lookupVariable(String name) {
|
public TypedValue lookupVariable(String name) {
|
||||||
Object value = this.relatedContext.lookupVariable(name);
|
Object value = this.relatedContext.lookupVariable(name);
|
||||||
if (value == null) {
|
return (value != null ? new TypedValue(value) : TypedValue.NULL);
|
||||||
return TypedValue.NULL;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return new TypedValue(value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public TypeComparator getTypeComparator() {
|
public TypeComparator getTypeComparator() {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2014 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -18,7 +18,6 @@ package org.springframework.expression.spel;
|
||||||
|
|
||||||
import org.springframework.core.SpringProperties;
|
import org.springframework.core.SpringProperties;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuration object for the SpEL expression parser.
|
* Configuration object for the SpEL expression parser.
|
||||||
*
|
*
|
||||||
|
|
@ -106,35 +105,35 @@ public class SpelParserConfiguration {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the configuration mode for parsers using this configuration object
|
* Return the configuration mode for parsers using this configuration object.
|
||||||
*/
|
*/
|
||||||
public SpelCompilerMode getCompilerMode() {
|
public SpelCompilerMode getCompilerMode() {
|
||||||
return this.compilerMode;
|
return this.compilerMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the ClassLoader to use as the basis for expression compilation
|
* Return the ClassLoader to use as the basis for expression compilation.
|
||||||
*/
|
*/
|
||||||
public ClassLoader getCompilerClassLoader() {
|
public ClassLoader getCompilerClassLoader() {
|
||||||
return this.compilerClassLoader;
|
return this.compilerClassLoader;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {@code true} if {@code null} references should be automatically grown
|
* Return {@code true} if {@code null} references should be automatically grown.
|
||||||
*/
|
*/
|
||||||
public boolean isAutoGrowNullReferences() {
|
public boolean isAutoGrowNullReferences() {
|
||||||
return this.autoGrowNullReferences;
|
return this.autoGrowNullReferences;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {@code true} if collections should be automatically grown
|
* Return {@code true} if collections should be automatically grown.
|
||||||
*/
|
*/
|
||||||
public boolean isAutoGrowCollections() {
|
public boolean isAutoGrowCollections() {
|
||||||
return this.autoGrowCollections;
|
return this.autoGrowCollections;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the maximum size that a collection can auto grow
|
* Return the maximum size that a collection can auto grow.
|
||||||
*/
|
*/
|
||||||
public int getMaximumAutoGrowSize() {
|
public int getMaximumAutoGrowSize() {
|
||||||
return this.maximumAutoGrowSize;
|
return this.maximumAutoGrowSize;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2014 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -37,7 +37,7 @@ public class BeanReference extends SpelNodeImpl {
|
||||||
private final String beanName;
|
private final String beanName;
|
||||||
|
|
||||||
|
|
||||||
public BeanReference(int pos,String beanName) {
|
public BeanReference(int pos, String beanName) {
|
||||||
super(pos);
|
super(pos);
|
||||||
this.beanName = beanName;
|
this.beanName = beanName;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2015 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -31,7 +31,7 @@ import org.springframework.expression.spel.SpelEvaluationException;
|
||||||
*/
|
*/
|
||||||
public class CompoundExpression extends SpelNodeImpl {
|
public class CompoundExpression extends SpelNodeImpl {
|
||||||
|
|
||||||
public CompoundExpression(int pos,SpelNodeImpl... expressionComponents) {
|
public CompoundExpression(int pos, SpelNodeImpl... expressionComponents) {
|
||||||
super(pos, expressionComponents);
|
super(pos, expressionComponents);
|
||||||
if (expressionComponents.length < 2) {
|
if (expressionComponents.length < 2) {
|
||||||
throw new IllegalStateException("Do not build compound expressions with less than two entries: " +
|
throw new IllegalStateException("Do not build compound expressions with less than two entries: " +
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -59,7 +59,7 @@ public class FunctionReference extends SpelNodeImpl {
|
||||||
|
|
||||||
|
|
||||||
public FunctionReference(String functionName, int pos, SpelNodeImpl... arguments) {
|
public FunctionReference(String functionName, int pos, SpelNodeImpl... arguments) {
|
||||||
super(pos,arguments);
|
super(pos, arguments);
|
||||||
this.name = functionName;
|
this.name = functionName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -107,15 +107,15 @@ public class FunctionReference extends SpelNodeImpl {
|
||||||
SpelMessage.FUNCTION_MUST_BE_STATIC, ClassUtils.getQualifiedMethodName(method), this.name);
|
SpelMessage.FUNCTION_MUST_BE_STATIC, ClassUtils.getQualifiedMethodName(method), this.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
argumentConversionOccurred = false;
|
this.argumentConversionOccurred = false;
|
||||||
// Convert arguments if necessary and remap them for varargs if required
|
// Convert arguments if necessary and remap them for varargs if required
|
||||||
if (functionArgs != null) {
|
if (functionArgs != null) {
|
||||||
TypeConverter converter = state.getEvaluationContext().getTypeConverter();
|
TypeConverter converter = state.getEvaluationContext().getTypeConverter();
|
||||||
argumentConversionOccurred = ReflectionHelper.convertAllArguments(converter, functionArgs, method);
|
this.argumentConversionOccurred = ReflectionHelper.convertAllArguments(converter, functionArgs, method);
|
||||||
}
|
}
|
||||||
if (method.isVarArgs()) {
|
if (method.isVarArgs()) {
|
||||||
functionArgs =
|
functionArgs = ReflectionHelper.setupArgumentsForVarargsInvocation(
|
||||||
ReflectionHelper.setupArgumentsForVarargsInvocation(method.getParameterTypes(), functionArgs);
|
method.getParameterTypes(), functionArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -51,7 +51,7 @@ import org.springframework.expression.spel.support.ReflectivePropertyAccessor;
|
||||||
// TODO support correct syntax for multidimensional [][][] and not [,,,]
|
// TODO support correct syntax for multidimensional [][][] and not [,,,]
|
||||||
public class Indexer extends SpelNodeImpl {
|
public class Indexer extends SpelNodeImpl {
|
||||||
|
|
||||||
private static enum IndexedType {ARRAY, LIST, MAP, STRING, OBJECT}
|
private enum IndexedType {ARRAY, LIST, MAP, STRING, OBJECT}
|
||||||
|
|
||||||
|
|
||||||
// These fields are used when the indexer is being used as a property read accessor.
|
// These fields are used when the indexer is being used as a property read accessor.
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2014 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -29,7 +29,7 @@ import org.springframework.expression.spel.CodeFlow;
|
||||||
public class NullLiteral extends Literal {
|
public class NullLiteral extends Literal {
|
||||||
|
|
||||||
public NullLiteral(int pos) {
|
public NullLiteral(int pos) {
|
||||||
super(null,pos);
|
super(null, pos);
|
||||||
this.exitTypeDescriptor = "Ljava/lang/Object";
|
this.exitTypeDescriptor = "Ljava/lang/Object";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2014 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -44,7 +44,7 @@ public class OpAnd extends Operator {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TypedValue getValueInternal(ExpressionState state) throws EvaluationException {
|
public TypedValue getValueInternal(ExpressionState state) throws EvaluationException {
|
||||||
if (getBooleanValue(state, getLeftOperand()) == false) {
|
if (!getBooleanValue(state, getLeftOperand())) {
|
||||||
// no need to evaluate right operand
|
// no need to evaluate right operand
|
||||||
return BooleanTypedValue.FALSE;
|
return BooleanTypedValue.FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -192,8 +192,8 @@ public class OpPlus extends Operator {
|
||||||
private void walk(MethodVisitor mv, CodeFlow cf, SpelNodeImpl operand) {
|
private void walk(MethodVisitor mv, CodeFlow cf, SpelNodeImpl operand) {
|
||||||
if (operand instanceof OpPlus) {
|
if (operand instanceof OpPlus) {
|
||||||
OpPlus plus = (OpPlus)operand;
|
OpPlus plus = (OpPlus)operand;
|
||||||
walk(mv,cf,plus.getLeftOperand());
|
walk(mv, cf, plus.getLeftOperand());
|
||||||
walk(mv,cf,plus.getRightOperand());
|
walk(mv, cf, plus.getRightOperand());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cf.enterCompilationScope();
|
cf.enterCompilationScope();
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ public abstract class Operator extends SpelNodeImpl {
|
||||||
|
|
||||||
protected boolean isCompilableOperatorUsingNumerics() {
|
protected boolean isCompilableOperatorUsingNumerics() {
|
||||||
SpelNodeImpl left = getLeftOperand();
|
SpelNodeImpl left = getLeftOperand();
|
||||||
SpelNodeImpl right= getRightOperand();
|
SpelNodeImpl right = getRightOperand();
|
||||||
if (!left.isCompilable() || !right.isCompilable()) {
|
if (!left.isCompilable() || !right.isCompilable()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -273,11 +273,11 @@ public abstract class Operator extends SpelNodeImpl {
|
||||||
boolean rightNumeric = CodeFlow.isPrimitiveOrUnboxableSupportedNumberOrBoolean(rd);
|
boolean rightNumeric = CodeFlow.isPrimitiveOrUnboxableSupportedNumberOrBoolean(rd);
|
||||||
|
|
||||||
// If the declared descriptors aren't providing the information, try the actual descriptors
|
// If the declared descriptors aren't providing the information, try the actual descriptors
|
||||||
if (!leftNumeric && !ld.equals(leftActualDescriptor)) {
|
if (!leftNumeric && !ObjectUtils.nullSafeEquals(ld, leftActualDescriptor)) {
|
||||||
ld = leftActualDescriptor;
|
ld = leftActualDescriptor;
|
||||||
leftNumeric = CodeFlow.isPrimitiveOrUnboxableSupportedNumberOrBoolean(ld);
|
leftNumeric = CodeFlow.isPrimitiveOrUnboxableSupportedNumberOrBoolean(ld);
|
||||||
}
|
}
|
||||||
if (!rightNumeric && !rd.equals(rightActualDescriptor)) {
|
if (!rightNumeric && !ObjectUtils.nullSafeEquals(rd, rightActualDescriptor)) {
|
||||||
rd = rightActualDescriptor;
|
rd = rightActualDescriptor;
|
||||||
rightNumeric = CodeFlow.isPrimitiveOrUnboxableSupportedNumberOrBoolean(rd);
|
rightNumeric = CodeFlow.isPrimitiveOrUnboxableSupportedNumberOrBoolean(rd);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2015 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2014 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -77,6 +77,7 @@ public abstract class SpelNodeImpl implements SpelNode, Opcodes {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
protected SpelNodeImpl getPreviousChild() {
|
protected SpelNodeImpl getPreviousChild() {
|
||||||
SpelNodeImpl result = null;
|
SpelNodeImpl result = null;
|
||||||
if (this.parent != null) {
|
if (this.parent != null) {
|
||||||
|
|
@ -214,9 +215,9 @@ public abstract class SpelNodeImpl implements SpelNode, Opcodes {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate code that handles building the argument values for the specified method. This method will take account
|
* Generate code that handles building the argument values for the specified method.
|
||||||
* of whether the invoked method is a varargs method and if it is then the argument values will be appropriately
|
* This method will take account of whether the invoked method is a varargs method
|
||||||
* packaged into an array.
|
* and if it is then the argument values will be appropriately packaged into an array.
|
||||||
* @param mv the method visitor where code should be generated
|
* @param mv the method visitor where code should be generated
|
||||||
* @param cf the current codeflow
|
* @param cf the current codeflow
|
||||||
* @param member the method or constructor for which arguments are being setup
|
* @param member the method or constructor for which arguments are being setup
|
||||||
|
|
@ -226,7 +227,7 @@ public abstract class SpelNodeImpl implements SpelNode, Opcodes {
|
||||||
String[] paramDescriptors = null;
|
String[] paramDescriptors = null;
|
||||||
boolean isVarargs = false;
|
boolean isVarargs = false;
|
||||||
if (member instanceof Constructor) {
|
if (member instanceof Constructor) {
|
||||||
Constructor<?> ctor = (Constructor<?>)member;
|
Constructor<?> ctor = (Constructor<?>) member;
|
||||||
paramDescriptors = CodeFlow.toDescriptors(ctor.getParameterTypes());
|
paramDescriptors = CodeFlow.toDescriptors(ctor.getParameterTypes());
|
||||||
isVarargs = ctor.isVarArgs();
|
isVarargs = ctor.isVarArgs();
|
||||||
}
|
}
|
||||||
|
|
@ -246,25 +247,25 @@ public abstract class SpelNodeImpl implements SpelNode, Opcodes {
|
||||||
generateCodeForArgument(mv, cf, arguments[p], paramDescriptors[p]);
|
generateCodeForArgument(mv, cf, arguments[p], paramDescriptors[p]);
|
||||||
}
|
}
|
||||||
|
|
||||||
SpelNodeImpl lastchild = (childCount == 0 ? null : arguments[childCount - 1]);
|
SpelNodeImpl lastChild = (childCount == 0 ? null : arguments[childCount - 1]);
|
||||||
String arraytype = paramDescriptors[paramDescriptors.length - 1];
|
String arrayType = paramDescriptors[paramDescriptors.length - 1];
|
||||||
// Determine if the final passed argument is already suitably packaged in array
|
// Determine if the final passed argument is already suitably packaged in array
|
||||||
// form to be passed to the method
|
// form to be passed to the method
|
||||||
if (lastchild != null && lastchild.getExitDescriptor().equals(arraytype)) {
|
if (lastChild != null && arrayType.equals(lastChild.getExitDescriptor())) {
|
||||||
generateCodeForArgument(mv, cf, lastchild, paramDescriptors[p]);
|
generateCodeForArgument(mv, cf, lastChild, paramDescriptors[p]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
arraytype = arraytype.substring(1); // trim the leading '[', may leave other '['
|
arrayType = arrayType.substring(1); // trim the leading '[', may leave other '['
|
||||||
// build array big enough to hold remaining arguments
|
// build array big enough to hold remaining arguments
|
||||||
CodeFlow.insertNewArrayCode(mv, childCount - p, arraytype);
|
CodeFlow.insertNewArrayCode(mv, childCount - p, arrayType);
|
||||||
// Package up the remaining arguments into the array
|
// Package up the remaining arguments into the array
|
||||||
int arrayindex = 0;
|
int arrayindex = 0;
|
||||||
while (p < childCount) {
|
while (p < childCount) {
|
||||||
SpelNodeImpl child = arguments[p];
|
SpelNodeImpl child = arguments[p];
|
||||||
mv.visitInsn(DUP);
|
mv.visitInsn(DUP);
|
||||||
CodeFlow.insertOptimalLoad(mv, arrayindex++);
|
CodeFlow.insertOptimalLoad(mv, arrayindex++);
|
||||||
generateCodeForArgument(mv, cf, child, arraytype);
|
generateCodeForArgument(mv, cf, child, arrayType);
|
||||||
CodeFlow.insertArrayStore(mv, arraytype);
|
CodeFlow.insertArrayStore(mv, arrayType);
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -283,15 +284,16 @@ public abstract class SpelNodeImpl implements SpelNode, Opcodes {
|
||||||
protected static void generateCodeForArgument(MethodVisitor mv, CodeFlow cf, SpelNodeImpl argument, String paramDesc) {
|
protected static void generateCodeForArgument(MethodVisitor mv, CodeFlow cf, SpelNodeImpl argument, String paramDesc) {
|
||||||
cf.enterCompilationScope();
|
cf.enterCompilationScope();
|
||||||
argument.generateCode(mv, cf);
|
argument.generateCode(mv, cf);
|
||||||
boolean primitiveOnStack = CodeFlow.isPrimitive(cf.lastDescriptor());
|
String lastDesc = cf.lastDescriptor();
|
||||||
|
boolean primitiveOnStack = CodeFlow.isPrimitive(lastDesc);
|
||||||
// Check if need to box it for the method reference?
|
// Check if need to box it for the method reference?
|
||||||
if (primitiveOnStack && paramDesc.charAt(0) == 'L') {
|
if (primitiveOnStack && paramDesc.charAt(0) == 'L') {
|
||||||
CodeFlow.insertBoxIfNecessary(mv, cf.lastDescriptor().charAt(0));
|
CodeFlow.insertBoxIfNecessary(mv, lastDesc.charAt(0));
|
||||||
}
|
}
|
||||||
else if (paramDesc.length() == 1 && !primitiveOnStack) {
|
else if (paramDesc.length() == 1 && !primitiveOnStack) {
|
||||||
CodeFlow.insertUnboxInsns(mv, paramDesc.charAt(0), cf.lastDescriptor());
|
CodeFlow.insertUnboxInsns(mv, paramDesc.charAt(0), lastDesc);
|
||||||
}
|
}
|
||||||
else if (!cf.lastDescriptor().equals(paramDesc)) {
|
else if (!paramDesc.equals(lastDesc)) {
|
||||||
// This would be unnecessary in the case of subtyping (e.g. method takes Number but Integer passed in)
|
// This would be unnecessary in the case of subtyping (e.g. method takes Number but Integer passed in)
|
||||||
CodeFlow.insertCheckCast(mv, paramDesc);
|
CodeFlow.insertCheckCast(mv, paramDesc);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2015 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -88,14 +88,13 @@ public class SpelCompiler implements Opcodes {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attempt compilation of the supplied expression. A check is
|
* Attempt compilation of the supplied expression. A check is made to see
|
||||||
* made to see if it is compilable before compilation proceeds. The
|
* if it is compilable before compilation proceeds. The check involves
|
||||||
* check involves visiting all the nodes in the expression Ast and
|
* visiting all the nodes in the expression Ast and ensuring enough state
|
||||||
* ensuring enough state is known about them that bytecode can
|
* is known about them that bytecode can be generated for them.
|
||||||
* be generated for them.
|
|
||||||
* @param expression the expression to compile
|
* @param expression the expression to compile
|
||||||
* @return an instance of the class implementing the compiled expression, or null
|
* @return an instance of the class implementing the compiled expression,
|
||||||
* if compilation is not possible
|
* or {@code null} if compilation is not possible
|
||||||
*/
|
*/
|
||||||
public CompiledExpression compile(SpelNodeImpl expression) {
|
public CompiledExpression compile(SpelNodeImpl expression) {
|
||||||
if (expression.isCompilable()) {
|
if (expression.isCompilable()) {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -27,6 +27,7 @@ import org.springframework.expression.TypeConverter;
|
||||||
import org.springframework.expression.spel.SpelEvaluationException;
|
import org.springframework.expression.spel.SpelEvaluationException;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
import org.springframework.util.ClassUtils;
|
import org.springframework.util.ClassUtils;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.util.MethodInvoker;
|
import org.springframework.util.MethodInvoker;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -141,8 +142,8 @@ public class ReflectionHelper {
|
||||||
static ArgumentsMatchInfo compareArgumentsVarargs(
|
static ArgumentsMatchInfo compareArgumentsVarargs(
|
||||||
List<TypeDescriptor> expectedArgTypes, List<TypeDescriptor> suppliedArgTypes, TypeConverter typeConverter) {
|
List<TypeDescriptor> expectedArgTypes, List<TypeDescriptor> suppliedArgTypes, TypeConverter typeConverter) {
|
||||||
|
|
||||||
Assert.isTrue(expectedArgTypes != null && expectedArgTypes.size() > 0,
|
Assert.isTrue(!CollectionUtils.isEmpty(expectedArgTypes),
|
||||||
"Expected arguments must at least include one array (the vargargs parameter)");
|
"Expected arguments must at least include one array (the varargs parameter)");
|
||||||
Assert.isTrue(expectedArgTypes.get(expectedArgTypes.size() - 1).isArray(),
|
Assert.isTrue(expectedArgTypes.get(expectedArgTypes.size() - 1).isArray(),
|
||||||
"Final expected argument should be array type (the varargs parameter)");
|
"Final expected argument should be array type (the varargs parameter)");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2015 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -44,6 +44,7 @@ public class ReflectiveMethodExecutor implements MethodExecutor {
|
||||||
|
|
||||||
private boolean argumentConversionOccurred = false;
|
private boolean argumentConversionOccurred = false;
|
||||||
|
|
||||||
|
|
||||||
public ReflectiveMethodExecutor(Method method) {
|
public ReflectiveMethodExecutor(Method method) {
|
||||||
this.method = method;
|
this.method = method;
|
||||||
if (method.isVarArgs()) {
|
if (method.isVarArgs()) {
|
||||||
|
|
@ -55,6 +56,7 @@ public class ReflectiveMethodExecutor implements MethodExecutor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Method getMethod() {
|
public Method getMethod() {
|
||||||
return this.method;
|
return this.method;
|
||||||
}
|
}
|
||||||
|
|
@ -68,8 +70,8 @@ public class ReflectiveMethodExecutor implements MethodExecutor {
|
||||||
* method (if there is one!). For toString() it may walk as far as Object.
|
* method (if there is one!). For toString() it may walk as far as Object.
|
||||||
*/
|
*/
|
||||||
public Class<?> getPublicDeclaringClass() {
|
public Class<?> getPublicDeclaringClass() {
|
||||||
if (!computedPublicDeclaringClass) {
|
if (!this.computedPublicDeclaringClass) {
|
||||||
this.publicDeclaringClass = discoverPublicClass(method, method.getDeclaringClass());
|
this.publicDeclaringClass = discoverPublicClass(this.method, this.method.getDeclaringClass());
|
||||||
this.computedPublicDeclaringClass = true;
|
this.computedPublicDeclaringClass = true;
|
||||||
}
|
}
|
||||||
return this.publicDeclaringClass;
|
return this.publicDeclaringClass;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2014 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -93,14 +93,23 @@ public class StandardEvaluationContext implements EvaluationContext {
|
||||||
return this.rootObject;
|
return this.rootObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addConstructorResolver(ConstructorResolver resolver) {
|
public void setPropertyAccessors(List<PropertyAccessor> propertyAccessors) {
|
||||||
ensureConstructorResolversInitialized();
|
this.propertyAccessors = propertyAccessors;
|
||||||
this.constructorResolvers.add(this.constructorResolvers.size() - 1, resolver);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean removeConstructorResolver(ConstructorResolver resolver) {
|
@Override
|
||||||
ensureConstructorResolversInitialized();
|
public List<PropertyAccessor> getPropertyAccessors() {
|
||||||
return this.constructorResolvers.remove(resolver);
|
ensurePropertyAccessorsInitialized();
|
||||||
|
return this.propertyAccessors;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addPropertyAccessor(PropertyAccessor accessor) {
|
||||||
|
ensurePropertyAccessorsInitialized();
|
||||||
|
this.propertyAccessors.add(this.propertyAccessors.size() - 1, accessor);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean removePropertyAccessor(PropertyAccessor accessor) {
|
||||||
|
return this.propertyAccessors.remove(accessor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setConstructorResolvers(List<ConstructorResolver> constructorResolvers) {
|
public void setConstructorResolvers(List<ConstructorResolver> constructorResolvers) {
|
||||||
|
|
@ -113,14 +122,14 @@ public class StandardEvaluationContext implements EvaluationContext {
|
||||||
return this.constructorResolvers;
|
return this.constructorResolvers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addMethodResolver(MethodResolver resolver) {
|
public void addConstructorResolver(ConstructorResolver resolver) {
|
||||||
ensureMethodResolversInitialized();
|
ensureConstructorResolversInitialized();
|
||||||
this.methodResolvers.add(this.methodResolvers.size() - 1, resolver);
|
this.constructorResolvers.add(this.constructorResolvers.size() - 1, resolver);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean removeMethodResolver(MethodResolver methodResolver) {
|
public boolean removeConstructorResolver(ConstructorResolver resolver) {
|
||||||
ensureMethodResolversInitialized();
|
ensureConstructorResolversInitialized();
|
||||||
return this.methodResolvers.remove(methodResolver);
|
return this.constructorResolvers.remove(resolver);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMethodResolvers(List<MethodResolver> methodResolvers) {
|
public void setMethodResolvers(List<MethodResolver> methodResolvers) {
|
||||||
|
|
@ -133,6 +142,16 @@ public class StandardEvaluationContext implements EvaluationContext {
|
||||||
return this.methodResolvers;
|
return this.methodResolvers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addMethodResolver(MethodResolver resolver) {
|
||||||
|
ensureMethodResolversInitialized();
|
||||||
|
this.methodResolvers.add(this.methodResolvers.size() - 1, resolver);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean removeMethodResolver(MethodResolver methodResolver) {
|
||||||
|
ensureMethodResolversInitialized();
|
||||||
|
return this.methodResolvers.remove(methodResolver);
|
||||||
|
}
|
||||||
|
|
||||||
public void setBeanResolver(BeanResolver beanResolver) {
|
public void setBeanResolver(BeanResolver beanResolver) {
|
||||||
this.beanResolver = beanResolver;
|
this.beanResolver = beanResolver;
|
||||||
}
|
}
|
||||||
|
|
@ -142,25 +161,6 @@ public class StandardEvaluationContext implements EvaluationContext {
|
||||||
return this.beanResolver;
|
return this.beanResolver;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addPropertyAccessor(PropertyAccessor accessor) {
|
|
||||||
ensurePropertyAccessorsInitialized();
|
|
||||||
this.propertyAccessors.add(this.propertyAccessors.size() - 1, accessor);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean removePropertyAccessor(PropertyAccessor accessor) {
|
|
||||||
return this.propertyAccessors.remove(accessor);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPropertyAccessors(List<PropertyAccessor> propertyAccessors) {
|
|
||||||
this.propertyAccessors = propertyAccessors;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<PropertyAccessor> getPropertyAccessors() {
|
|
||||||
ensurePropertyAccessorsInitialized();
|
|
||||||
return this.propertyAccessors;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTypeLocator(TypeLocator typeLocator) {
|
public void setTypeLocator(TypeLocator typeLocator) {
|
||||||
Assert.notNull(typeLocator, "TypeLocator must not be null");
|
Assert.notNull(typeLocator, "TypeLocator must not be null");
|
||||||
this.typeLocator = typeLocator;
|
this.typeLocator = typeLocator;
|
||||||
|
|
@ -169,7 +169,7 @@ public class StandardEvaluationContext implements EvaluationContext {
|
||||||
@Override
|
@Override
|
||||||
public TypeLocator getTypeLocator() {
|
public TypeLocator getTypeLocator() {
|
||||||
if (this.typeLocator == null) {
|
if (this.typeLocator == null) {
|
||||||
this.typeLocator = new StandardTypeLocator();
|
this.typeLocator = new StandardTypeLocator();
|
||||||
}
|
}
|
||||||
return this.typeLocator;
|
return this.typeLocator;
|
||||||
}
|
}
|
||||||
|
|
@ -244,6 +244,7 @@ public class StandardEvaluationContext implements EvaluationContext {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void ensurePropertyAccessorsInitialized() {
|
private void ensurePropertyAccessorsInitialized() {
|
||||||
if (this.propertyAccessors == null) {
|
if (this.propertyAccessors == null) {
|
||||||
initializePropertyAccessors();
|
initializePropertyAccessors();
|
||||||
|
|
@ -258,6 +259,20 @@ public class StandardEvaluationContext implements EvaluationContext {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ensureConstructorResolversInitialized() {
|
||||||
|
if (this.constructorResolvers == null) {
|
||||||
|
initializeConstructorResolvers();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private synchronized void initializeConstructorResolvers() {
|
||||||
|
if (this.constructorResolvers == null) {
|
||||||
|
List<ConstructorResolver> defaultResolvers = new ArrayList<ConstructorResolver>();
|
||||||
|
defaultResolvers.add(new ReflectiveConstructorResolver());
|
||||||
|
this.constructorResolvers = defaultResolvers;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void ensureMethodResolversInitialized() {
|
private void ensureMethodResolversInitialized() {
|
||||||
if (this.methodResolvers == null) {
|
if (this.methodResolvers == null) {
|
||||||
initializeMethodResolvers();
|
initializeMethodResolvers();
|
||||||
|
|
@ -273,18 +288,4 @@ public class StandardEvaluationContext implements EvaluationContext {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ensureConstructorResolversInitialized() {
|
|
||||||
if (this.constructorResolvers == null) {
|
|
||||||
initializeConstructorResolvers();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private synchronized void initializeConstructorResolvers() {
|
|
||||||
if (this.constructorResolvers == null) {
|
|
||||||
List<ConstructorResolver> defaultResolvers = new ArrayList<ConstructorResolver>();
|
|
||||||
defaultResolvers.add(new ReflectiveConstructorResolver());
|
|
||||||
this.constructorResolvers = defaultResolvers;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -67,8 +67,9 @@ public class StandardTypeConverter implements TypeConverter {
|
||||||
return this.conversionService.convert(value, sourceType, targetType);
|
return this.conversionService.convert(value, sourceType, targetType);
|
||||||
}
|
}
|
||||||
catch (ConversionException ex) {
|
catch (ConversionException ex) {
|
||||||
throw new SpelEvaluationException(
|
throw new SpelEvaluationException(ex, SpelMessage.TYPE_CONVERSION_ERROR,
|
||||||
ex, SpelMessage.TYPE_CONVERSION_ERROR, sourceType.toString(), targetType.toString());
|
(sourceType != null ? sourceType.toString() : (value != null ? value.getClass().getName() : "null")),
|
||||||
|
targetType.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -408,7 +408,7 @@ public class LazyConnectionDataSourceProxy extends DelegatingDataSource {
|
||||||
// Apply kept transaction settings, if any.
|
// Apply kept transaction settings, if any.
|
||||||
if (this.readOnly) {
|
if (this.readOnly) {
|
||||||
try {
|
try {
|
||||||
this.target.setReadOnly(this.readOnly);
|
this.target.setReadOnly(true);
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
// "read-only not supported" -> ignore, it's just a hint anyway
|
// "read-only not supported" -> ignore, it's just a hint anyway
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -153,7 +153,7 @@ public class ResourceDatabasePopulator implements DatabasePopulator {
|
||||||
* @see #addScript(Resource)
|
* @see #addScript(Resource)
|
||||||
*/
|
*/
|
||||||
public void setSqlScriptEncoding(String sqlScriptEncoding) {
|
public void setSqlScriptEncoding(String sqlScriptEncoding) {
|
||||||
this.sqlScriptEncoding = StringUtils.hasText(sqlScriptEncoding) ? sqlScriptEncoding : null;
|
this.sqlScriptEncoding = (StringUtils.hasText(sqlScriptEncoding) ? sqlScriptEncoding : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2013 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
package org.springframework.messaging.converter;
|
package org.springframework.messaging.converter;
|
||||||
|
|
||||||
import org.springframework.messaging.MessageHeaders;
|
import org.springframework.messaging.MessageHeaders;
|
||||||
|
import org.springframework.util.InvalidMimeTypeException;
|
||||||
import org.springframework.util.MimeType;
|
import org.springframework.util.MimeType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -29,15 +30,11 @@ public interface ContentTypeResolver {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine the {@link MimeType} of a message from the given MessageHeaders.
|
* Determine the {@link MimeType} of a message from the given MessageHeaders.
|
||||||
*
|
|
||||||
* @param headers the headers to use for the resolution
|
* @param headers the headers to use for the resolution
|
||||||
* @return the resolved {@code MimeType} of {@code null} if none found
|
* @return the resolved {@code MimeType}, or {@code null} if none found
|
||||||
*
|
* @throws InvalidMimeTypeException if the content type is a String that cannot be parsed
|
||||||
* @throws org.springframework.util.InvalidMimeTypeException if the content type
|
* @throws IllegalArgumentException if there is a content type but its type is unknown
|
||||||
* is a String that cannot be parsed
|
|
||||||
* @throws java.lang.IllegalArgumentException if there is a content type but
|
|
||||||
* its type is unknown
|
|
||||||
*/
|
*/
|
||||||
MimeType resolve(MessageHeaders headers);
|
MimeType resolve(MessageHeaders headers) throws InvalidMimeTypeException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2015 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -175,7 +175,7 @@ public class MarshallingMessageConverter extends AbstractMessageConverter {
|
||||||
payload = writer.toString();
|
payload = writer.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Throwable ex) {
|
||||||
throw new MessageConversionException("Could not marshal XML: " + ex.getMessage(), ex);
|
throw new MessageConversionException("Could not marshal XML: " + ex.getMessage(), ex);
|
||||||
}
|
}
|
||||||
return payload;
|
return payload;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2015 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -190,6 +190,9 @@ public class DestinationPatternsMessageCondition extends AbstractMessageConditio
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(DestinationPatternsMessageCondition other, Message<?> message) {
|
public int compareTo(DestinationPatternsMessageCondition other, Message<?> message) {
|
||||||
String destination = (String) message.getHeaders().get(LOOKUP_DESTINATION_HEADER);
|
String destination = (String) message.getHeaders().get(LOOKUP_DESTINATION_HEADER);
|
||||||
|
if (destination == null) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Comparator<String> patternComparator = this.pathMatcher.getPatternComparator(destination);
|
Comparator<String> patternComparator = this.pathMatcher.getPatternComparator(destination);
|
||||||
|
|
||||||
Iterator<String> iterator = patterns.iterator();
|
Iterator<String> iterator = patterns.iterator();
|
||||||
|
|
|
||||||
|
|
@ -38,11 +38,14 @@ import org.springframework.util.ClassUtils;
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractExceptionHandlerMethodResolver {
|
public abstract class AbstractExceptionHandlerMethodResolver {
|
||||||
|
|
||||||
private static final Method NO_METHOD_FOUND = ClassUtils.getMethodIfAvailable(System.class, "currentTimeMillis");
|
private static final Method NO_METHOD_FOUND =
|
||||||
|
ClassUtils.getMethodIfAvailable(System.class, "currentTimeMillis");
|
||||||
|
|
||||||
private final Map<Class<? extends Throwable>, Method> mappedMethods = new ConcurrentHashMap<Class<? extends Throwable>, Method>(16);
|
private final Map<Class<? extends Throwable>, Method> mappedMethods =
|
||||||
|
new ConcurrentHashMap<Class<? extends Throwable>, Method>(16);
|
||||||
|
|
||||||
private final Map<Class<? extends Throwable>, Method> exceptionLookupCache = new ConcurrentHashMap<Class<? extends Throwable>, Method>(16);
|
private final Map<Class<? extends Throwable>, Method> exceptionLookupCache =
|
||||||
|
new ConcurrentHashMap<Class<? extends Throwable>, Method>(16);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2013 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -40,13 +40,13 @@ public interface HandlerMethodReturnValueHandler {
|
||||||
/**
|
/**
|
||||||
* Handle the given return value.
|
* Handle the given return value.
|
||||||
* @param returnValue the value returned from the handler method
|
* @param returnValue the value returned from the handler method
|
||||||
* @param returnType the type of the return value. This type must have
|
* @param returnType the type of the return value. This type must have previously
|
||||||
* previously been passed to
|
* been passed to {@link #supportsReturnType(org.springframework.core.MethodParameter)}
|
||||||
* {@link #supportsReturnType(org.springframework.core.MethodParameter)}
|
* and it must have returned {@code true}.
|
||||||
* and it must have returned {@code true}
|
|
||||||
* @param message the message that caused this method to be called
|
* @param message the message that caused this method to be called
|
||||||
* @throws Exception if the return value handling results in an error
|
* @throws Exception if the return value handling results in an error
|
||||||
*/
|
*/
|
||||||
void handleReturnValue(Object returnValue, MethodParameter returnType, Message<?> message) throws Exception;
|
void handleReturnValue(Object returnValue, MethodParameter returnType, Message<?> message)
|
||||||
|
throws Exception;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2014 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -19,7 +19,6 @@ package org.springframework.messaging.simp;
|
||||||
import org.springframework.core.NamedThreadLocal;
|
import org.springframework.core.NamedThreadLocal;
|
||||||
import org.springframework.messaging.Message;
|
import org.springframework.messaging.Message;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holder class to expose SiMP attributes associated with a session (e.g. WebSocket)
|
* Holder class to expose SiMP attributes associated with a session (e.g. WebSocket)
|
||||||
* in the form of a thread-bound {@link SimpAttributes} object.
|
* in the form of a thread-bound {@link SimpAttributes} object.
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue