Backport selected refinements from the nullability efforts
Issue: SPR-15656
This commit is contained in:
@@ -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");
|
||||
* 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) {
|
||||
if (!parserContext.getRegistry().containsBeanDefinition(CacheManagementConfigUtils.JCACHE_ADVISOR_BEAN_NAME)) {
|
||||
Object eleSource = parserContext.extractSource(element);
|
||||
Object source = parserContext.extractSource(element);
|
||||
|
||||
// Create the CacheOperationSource definition.
|
||||
BeanDefinition sourceDef = createJCacheOperationSourceBeanDefinition(element, eleSource);
|
||||
BeanDefinition sourceDef = createJCacheOperationSourceBeanDefinition(element, source);
|
||||
String sourceName = parserContext.getReaderContext().registerWithGeneratedName(sourceDef);
|
||||
|
||||
// Create the CacheInterceptor definition.
|
||||
RootBeanDefinition interceptorDef =
|
||||
new RootBeanDefinition("org.springframework.cache.jcache.interceptor.JCacheInterceptor");
|
||||
interceptorDef.setSource(eleSource);
|
||||
interceptorDef.setSource(source);
|
||||
interceptorDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
|
||||
interceptorDef.getPropertyValues().add("cacheOperationSource", new RuntimeBeanReference(sourceName));
|
||||
parseErrorHandler(element, interceptorDef);
|
||||
@@ -219,7 +219,7 @@ class AnnotationDrivenCacheBeanDefinitionParser implements BeanDefinitionParser
|
||||
// Create the CacheAdvisor definition.
|
||||
RootBeanDefinition advisorDef = new RootBeanDefinition(
|
||||
"org.springframework.cache.jcache.interceptor.BeanFactoryJCacheOperationSourceAdvisor");
|
||||
advisorDef.setSource(eleSource);
|
||||
advisorDef.setSource(source);
|
||||
advisorDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
|
||||
advisorDef.getPropertyValues().add("cacheOperationSource", new RuntimeBeanReference(sourceName));
|
||||
advisorDef.getPropertyValues().add("adviceBeanName", interceptorName);
|
||||
@@ -228,7 +228,7 @@ class AnnotationDrivenCacheBeanDefinitionParser implements BeanDefinitionParser
|
||||
}
|
||||
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(interceptorDef, interceptorName));
|
||||
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");
|
||||
* 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[] caches = null;
|
||||
private String[] caches;
|
||||
|
||||
Props(Element root) {
|
||||
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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -164,7 +164,6 @@ public abstract class CacheAspectSupport extends AbstractCacheInvoker
|
||||
* @see SimpleCacheResolver
|
||||
*/
|
||||
public void setCacheResolver(CacheResolver cacheResolver) {
|
||||
Assert.notNull(cacheResolver, "CacheResolver must not be null");
|
||||
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");
|
||||
* 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);
|
||||
if (targetMethod == null) {
|
||||
targetMethod = AopUtils.getMostSpecificMethod(method, targetClass);
|
||||
if (targetMethod == null) {
|
||||
targetMethod = method;
|
||||
}
|
||||
this.targetMethodCache.put(methodKey, 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");
|
||||
* 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.
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author Juergen Hoeller
|
||||
* @since 3.1
|
||||
* @see org.springframework.aop.framework.ProxyFactoryBean
|
||||
* @see CacheInterceptor
|
||||
@@ -44,9 +45,16 @@ public class CacheProxyFactoryBean extends AbstractSingletonProxyFactoryBean {
|
||||
|
||||
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
|
||||
* of the CacheInterceptor depending on method and attributes passed.
|
||||
@@ -61,18 +69,7 @@ public class CacheProxyFactoryBean extends AbstractSingletonProxyFactoryBean {
|
||||
@Override
|
||||
protected Object createMainInterceptor() {
|
||||
this.cachingInterceptor.afterPropertiesSet();
|
||||
if (this.pointcut == null) {
|
||||
// Rely on default pointcut.
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
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");
|
||||
* 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 org.springframework.cache.Cache;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* A no operation {@link Cache} implementation suitable
|
||||
* for disabling caching.
|
||||
* A no operation {@link Cache} implementation suitable for disabling caching.
|
||||
*
|
||||
* <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;
|
||||
|
||||
|
||||
/**
|
||||
* Create a {@link NoOpCache} instance with the specified name
|
||||
* @param name the name of the cache
|
||||
*/
|
||||
public NoOpCache(String name) {
|
||||
Assert.notNull(name, "Cache name must not be null");
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void evict(Object key) {
|
||||
public Object getNativeCache() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -70,16 +75,6 @@ public class NoOpCache implements Cache {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getNativeCache() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void put(Object key, Object value) {
|
||||
}
|
||||
@@ -89,4 +84,12 @@ public class NoOpCache implements Cache {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void evict(Object key) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -66,8 +66,8 @@ class ComponentScanAnnotationParser {
|
||||
public ComponentScanAnnotationParser(Environment environment, ResourceLoader resourceLoader,
|
||||
BeanNameGenerator beanNameGenerator, BeanDefinitionRegistry registry) {
|
||||
|
||||
this.resourceLoader = resourceLoader;
|
||||
this.environment = environment;
|
||||
this.resourceLoader = resourceLoader;
|
||||
this.beanNameGenerator = beanNameGenerator;
|
||||
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");
|
||||
* 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") {
|
||||
@Override
|
||||
@@ -146,7 +146,7 @@ public class MBeanExportConfiguration implements ImportAware, EnvironmentAware,
|
||||
|
||||
private final String identifyingClass;
|
||||
|
||||
private SpecificPlatform(String identifyingClass) {
|
||||
SpecificPlatform(String 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");
|
||||
* 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,
|
||||
AnnotatedElementKey elementKey, EvaluationContext evalContext) {
|
||||
|
||||
return getExpression(this.conditionCache, elementKey, conditionExpression)
|
||||
.getValue(evalContext, boolean.class);
|
||||
return getExpression(this.conditionCache, elementKey, conditionExpression).getValue(
|
||||
evalContext, boolean.class);
|
||||
}
|
||||
|
||||
private Method getTargetMethod(Class<?> targetClass, Method method) {
|
||||
@@ -77,9 +77,6 @@ class EventExpressionEvaluator extends CachedExpressionEvaluator {
|
||||
Method targetMethod = this.targetMethodCache.get(methodKey);
|
||||
if (targetMethod == null) {
|
||||
targetMethod = AopUtils.getMostSpecificMethod(method, targetClass);
|
||||
if (targetMethod == null) {
|
||||
targetMethod = method;
|
||||
}
|
||||
this.targetMethodCache.put(methodKey, 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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -64,15 +64,14 @@ public class EventPublicationInterceptor
|
||||
*/
|
||||
public void setApplicationEventClass(Class<?> applicationEventClass) {
|
||||
if (ApplicationEvent.class == applicationEventClass ||
|
||||
!ApplicationEvent.class.isAssignableFrom(applicationEventClass)) {
|
||||
throw new IllegalArgumentException("applicationEventClass needs to extend ApplicationEvent");
|
||||
!ApplicationEvent.class.isAssignableFrom(applicationEventClass)) {
|
||||
throw new IllegalArgumentException("'applicationEventClass' needs to extend ApplicationEvent");
|
||||
}
|
||||
try {
|
||||
this.applicationEventClassConstructor =
|
||||
applicationEventClass.getConstructor(new Class<?>[] {Object.class});
|
||||
this.applicationEventClassConstructor = applicationEventClass.getConstructor(Object.class);
|
||||
}
|
||||
catch (NoSuchMethodException ex) {
|
||||
throw new IllegalArgumentException("applicationEventClass [" +
|
||||
throw new IllegalArgumentException("ApplicationEvent class [" +
|
||||
applicationEventClass.getName() + "] does not have the required Object constructor: " + ex);
|
||||
}
|
||||
}
|
||||
@@ -85,7 +84,7 @@ public class EventPublicationInterceptor
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
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();
|
||||
|
||||
ApplicationEvent event = (ApplicationEvent)
|
||||
this.applicationEventClassConstructor.newInstance(new Object[] {invocation.getThis()});
|
||||
this.applicationEventClassConstructor.newInstance(invocation.getThis());
|
||||
this.applicationEventPublisher.publishEvent(event);
|
||||
|
||||
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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -75,12 +75,8 @@ public class GenericApplicationListenerAdapter implements GenericApplicationList
|
||||
|
||||
@Override
|
||||
public boolean supportsSourceType(Class<?> sourceType) {
|
||||
if (this.delegate instanceof SmartApplicationListener) {
|
||||
return ((SmartApplicationListener) this.delegate).supportsSourceType(sourceType);
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
return !(this.delegate instanceof SmartApplicationListener) ||
|
||||
((SmartApplicationListener) this.delegate).supportsSourceType(sourceType);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -91,17 +87,13 @@ public class GenericApplicationListenerAdapter implements GenericApplicationList
|
||||
|
||||
static ResolvableType resolveDeclaredEventType(Class<?> listenerType) {
|
||||
ResolvableType resolvableType = ResolvableType.forClass(listenerType).as(ApplicationListener.class);
|
||||
if (resolvableType == null || !resolvableType.hasGenerics()) {
|
||||
return null;
|
||||
}
|
||||
return resolvableType.getGeneric();
|
||||
return (resolvableType.hasGenerics() ? resolvableType.getGeneric() : null);
|
||||
}
|
||||
|
||||
private static ResolvableType resolveDeclaredEventType(ApplicationListener<ApplicationEvent> listener) {
|
||||
ResolvableType declaredEventType = resolveDeclaredEventType(listener.getClass());
|
||||
if (declaredEventType == null || declaredEventType.isAssignableFrom(
|
||||
ResolvableType.forClass(ApplicationEvent.class))) {
|
||||
|
||||
Class<?> targetClass = AopUtils.getTargetClass(listener);
|
||||
if (targetClass != listener.getClass()) {
|
||||
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");
|
||||
* 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) {
|
||||
int result = this.element.toString().compareTo(other.element.toString());
|
||||
if (result == 0 && this.targetClass != null) {
|
||||
if (other.targetClass == null) {
|
||||
return 1;
|
||||
}
|
||||
result = this.targetClass.getName().compareTo(other.targetClass.getName());
|
||||
}
|
||||
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");
|
||||
* 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);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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
|
||||
public boolean isCompilable() {
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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");
|
||||
* 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);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
catch (Throwable 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");
|
||||
* 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,
|
||||
* 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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getCodes() {
|
||||
return this.codes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] getArguments() {
|
||||
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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -40,6 +40,7 @@ public class MessageSourceAccessor {
|
||||
|
||||
private final Locale defaultLocale;
|
||||
|
||||
|
||||
/**
|
||||
* Create a new MessageSourceAccessor, using LocaleContextHolder's locale
|
||||
* as default locale.
|
||||
@@ -61,6 +62,7 @@ public class MessageSourceAccessor {
|
||||
this.defaultLocale = defaultLocale;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the default locale to use if no explicit locale has been given.
|
||||
* <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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -67,12 +67,12 @@ public class SimpleThreadScope implements Scope {
|
||||
@Override
|
||||
public Object get(String name, ObjectFactory<?> objectFactory) {
|
||||
Map<String, Object> scope = this.threadScope.get();
|
||||
Object object = scope.get(name);
|
||||
if (object == null) {
|
||||
object = objectFactory.getObject();
|
||||
scope.put(name, object);
|
||||
Object scopedObject = scope.get(name);
|
||||
if (scopedObject == null) {
|
||||
scopedObject = objectFactory.getObject();
|
||||
scope.put(name, scopedObject);
|
||||
}
|
||||
return object;
|
||||
return scopedObject;
|
||||
}
|
||||
|
||||
@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");
|
||||
* 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.
|
||||
* @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");
|
||||
* 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");
|
||||
* 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.
|
||||
* @see java.text.DecimalFormat#applyPattern(String)
|
||||
*/
|
||||
|
||||
@@ -48,10 +48,20 @@ public class GlassFishLoadTimeWeaver implements LoadTimeWeaver {
|
||||
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() {
|
||||
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) {
|
||||
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");
|
||||
* 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}.
|
||||
* @param transformer the {@link ClassFileTransformer} to be adapted
|
||||
* (must not be {@code null})
|
||||
* Construct a new {@link WebLogicClassPreProcessorAdapter}.
|
||||
*/
|
||||
public WebLogicClassPreProcessorAdapter(ClassFileTransformer transformer, ClassLoader loader) {
|
||||
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");
|
||||
* 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.
|
||||
* Compatible with WebSphere 7 as well as 8.
|
||||
* Compatible with WebSphere 7 as well as 8 and 9.
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @since 3.1
|
||||
@@ -48,7 +48,6 @@ public class WebSphereLoadTimeWeaver implements LoadTimeWeaver {
|
||||
* Create a new instance of the {@link WebSphereLoadTimeWeaver} class using
|
||||
* the supplied {@link ClassLoader}.
|
||||
* @param classLoader the {@code ClassLoader} to delegate to for weaving
|
||||
* (must not be {@code null})
|
||||
*/
|
||||
public WebSphereLoadTimeWeaver(ClassLoader classLoader) {
|
||||
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");
|
||||
* 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
|
||||
implements BeanClassLoaderAware, InitializingBean {
|
||||
|
||||
/**
|
||||
* Stores the array of interfaces to use for creating the management interface.
|
||||
*/
|
||||
private Class<?>[] managedInterfaces;
|
||||
|
||||
/**
|
||||
* Stores the mappings of bean keys to an array of {@code Class}es.
|
||||
*/
|
||||
/** Mappings of bean keys to an array of classes */
|
||||
private Properties interfaceMappings;
|
||||
|
||||
private ClassLoader beanClassLoader = ClassUtils.getDefaultClassLoader();
|
||||
|
||||
/**
|
||||
* Stores the mappings of bean keys to an array of {@code Class}es.
|
||||
*/
|
||||
/** Mappings of bean keys to an array of classes */
|
||||
private Map<String, Class<?>[]> resolvedInterfaceMappings;
|
||||
|
||||
|
||||
@@ -86,7 +79,7 @@ public class InterfaceBasedMBeanInfoAssembler extends AbstractConfigurableMBeanI
|
||||
* Each entry <strong>MUST</strong> be an interface.
|
||||
* @see #setInterfaceMappings
|
||||
*/
|
||||
public void setManagedInterfaces(Class<?>[] managedInterfaces) {
|
||||
public void setManagedInterfaces(Class<?>... managedInterfaces) {
|
||||
if (managedInterfaces != null) {
|
||||
for (Class<?> ifc : managedInterfaces) {
|
||||
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
|
||||
* the list of interface names. When searching for interfaces for a bean, Spring
|
||||
* 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) {
|
||||
this.interfaceMappings = mappings;
|
||||
@@ -230,13 +223,11 @@ public class InterfaceBasedMBeanInfoAssembler extends AbstractConfigurableMBeanI
|
||||
}
|
||||
}
|
||||
|
||||
if (ifaces != null) {
|
||||
for (Class<?> ifc : ifaces) {
|
||||
for (Method ifcMethod : ifc.getMethods()) {
|
||||
if (ifcMethod.getName().equals(method.getName()) &&
|
||||
Arrays.equals(ifcMethod.getParameterTypes(), method.getParameterTypes())) {
|
||||
return true;
|
||||
}
|
||||
for (Class<?> ifc : ifaces) {
|
||||
for (Method ifcMethod : ifc.getMethods()) {
|
||||
if (ifcMethod.getName().equals(method.getName()) &&
|
||||
Arrays.equals(ifcMethod.getParameterTypes(), method.getParameterTypes())) {
|
||||
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");
|
||||
* 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.ManagedOperationParameter;
|
||||
import org.springframework.jmx.export.metadata.ManagedResource;
|
||||
import org.springframework.jmx.support.MetricType;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Implementation of the {@link MBeanInfoAssembler}
|
||||
* interface that reads the management interface information from source level metadata.
|
||||
* Implementation of the {@link MBeanInfoAssembler} interface that reads
|
||||
* the management interface information from source level metadata.
|
||||
*
|
||||
* <p>Uses the {@link JmxAttributeSource} strategy interface, so that
|
||||
* 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}.
|
||||
*
|
||||
* @author Rob Harrop
|
||||
@@ -339,9 +338,9 @@ public class MetadataMBeanInfoAssembler extends AbstractReflectiveMBeanInfoAssem
|
||||
}
|
||||
else {
|
||||
ManagedAttribute gma =
|
||||
(getter == null) ? ManagedAttribute.EMPTY : this.attributeSource.getManagedAttribute(getter);
|
||||
(getter == null) ? ManagedAttribute.EMPTY : this.attributeSource.getManagedAttribute(getter);
|
||||
ManagedAttribute sma =
|
||||
(setter == null) ? ManagedAttribute.EMPTY : this.attributeSource.getManagedAttribute(setter);
|
||||
(setter == null) ? ManagedAttribute.EMPTY : this.attributeSource.getManagedAttribute(setter);
|
||||
populateAttributeDescriptor(desc,gma,sma);
|
||||
}
|
||||
}
|
||||
@@ -384,8 +383,7 @@ public class MetadataMBeanInfoAssembler extends AbstractReflectiveMBeanInfoAssem
|
||||
desc.setField(FIELD_METRIC_CATEGORY, metric.getCategory());
|
||||
}
|
||||
|
||||
String metricType = (metric.getMetricType() == null) ? MetricType.GAUGE.toString() : metric.getMetricType().toString();
|
||||
desc.setField(FIELD_METRIC_TYPE, metricType);
|
||||
desc.setField(FIELD_METRIC_TYPE, metric.getMetricType().toString());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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");
|
||||
* 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 org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
@@ -34,16 +35,16 @@ public abstract class JmxMetadataUtils {
|
||||
* {@link javax.management.modelmbean.ModelMBeanNotificationInfo}.
|
||||
*/
|
||||
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();
|
||||
if (!StringUtils.hasText(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();
|
||||
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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.springframework.jmx.export.metadata;
|
||||
|
||||
import org.springframework.jmx.support.MetricType;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
public void setMetricType(MetricType metricType) {
|
||||
Assert.notNull(metricType, "MetricType must not be null");
|
||||
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");
|
||||
* 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
|
||||
* {@code mappingLocations} into the final {@code Properties} instance
|
||||
* used for {@code ObjectName} resolution.
|
||||
* @throws IOException
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() throws IOException {
|
||||
this.mergedMappings = new Properties();
|
||||
|
||||
CollectionUtils.mergePropertiesIntoMap(this.mappings, this.mergedMappings);
|
||||
|
||||
if (this.mappingLocations != null) {
|
||||
for (int i = 0; i < this.mappingLocations.length; i++) {
|
||||
Resource location = this.mappingLocations[i];
|
||||
for (Resource location : this.mappingLocations) {
|
||||
if (logger.isInfoEnabled()) {
|
||||
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");
|
||||
* 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.
|
||||
*
|
||||
* @author Jennifer Hickey
|
||||
* @since 3.0
|
||||
*/
|
||||
public enum MetricType {
|
||||
|
||||
/**
|
||||
* The measurement values may go up or down over time
|
||||
* The measurement values may go up or down over time.
|
||||
*/
|
||||
GAUGE,
|
||||
|
||||
/**
|
||||
* The measurement values will always increase
|
||||
* The measurement values will always increase.
|
||||
*/
|
||||
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");
|
||||
* 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
|
||||
* with the encapsulated {@link #getNotificationFilter() NotificationFilter}.
|
||||
* with the encapsulated {@link #getNotificationListener() NotificationListener}.
|
||||
* <p>May be {@code null}.
|
||||
*/
|
||||
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");
|
||||
* 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.
|
||||
*/
|
||||
public void setErrorHandler(ErrorHandler errorHandler) {
|
||||
Assert.notNull(errorHandler, "'errorHandler' must not be null");
|
||||
Assert.notNull(errorHandler, "ErrorHandler must not be null");
|
||||
this.errorHandler = errorHandler;
|
||||
}
|
||||
|
||||
@@ -166,7 +166,8 @@ public class ConcurrentTaskScheduler extends ConcurrentTaskExecutor implements T
|
||||
return new EnterpriseConcurrentTriggerScheduler().schedule(decorateTask(task, true), trigger);
|
||||
}
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -248,9 +249,9 @@ public class ConcurrentTaskScheduler extends ConcurrentTaskExecutor implements T
|
||||
return executor.schedule(task, new javax.enterprise.concurrent.Trigger() {
|
||||
@Override
|
||||
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());
|
||||
new SimpleTriggerContext()));
|
||||
}
|
||||
@Override
|
||||
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");
|
||||
* 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.
|
||||
* @see java.util.concurrent.ExecutorService#shutdown()
|
||||
* @see java.util.concurrent.ExecutorService#shutdownNow()
|
||||
* @see #awaitTerminationIfNecessary()
|
||||
*/
|
||||
public void shutdown() {
|
||||
if (logger.isInfoEnabled()) {
|
||||
logger.info("Shutting down ExecutorService" + (this.beanName != null ? " '" + this.beanName + "'" : ""));
|
||||
}
|
||||
if (this.waitForTasksToCompleteOnShutdown) {
|
||||
this.executor.shutdown();
|
||||
if (this.executor != null) {
|
||||
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
|
||||
* {@link #setAwaitTerminationSeconds "awaitTerminationSeconds"} property.
|
||||
*/
|
||||
private void awaitTerminationIfNecessary() {
|
||||
private void awaitTerminationIfNecessary(ExecutorService executor) {
|
||||
if (this.awaitTerminationSeconds > 0) {
|
||||
try {
|
||||
if (!this.executor.awaitTermination(this.awaitTerminationSeconds, TimeUnit.SECONDS)) {
|
||||
if (!executor.awaitTermination(this.awaitTerminationSeconds, TimeUnit.SECONDS)) {
|
||||
if (logger.isWarnEnabled()) {
|
||||
logger.warn("Timed out while waiting for executor" +
|
||||
(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");
|
||||
* 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 ScheduledExecutorService scheduledExecutor;
|
||||
|
||||
private volatile ErrorHandler errorHandler;
|
||||
|
||||
private volatile ScheduledExecutorService scheduledExecutor;
|
||||
|
||||
|
||||
/**
|
||||
* 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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -116,7 +116,8 @@ public class PeriodicTrigger implements Trigger {
|
||||
return false;
|
||||
}
|
||||
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
|
||||
|
||||
@@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -271,8 +271,8 @@ public class ScriptFactoryPostProcessor extends InstantiationAwareBeanPostProces
|
||||
}
|
||||
}
|
||||
catch (Exception ex) {
|
||||
if (ex instanceof BeanCreationException
|
||||
&& ((BeanCreationException) ex).getMostSpecificCause() instanceof BeanCurrentlyInCreationException) {
|
||||
if (ex instanceof BeanCreationException &&
|
||||
((BeanCreationException) ex).getMostSpecificCause() instanceof BeanCurrentlyInCreationException) {
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Could not determine scripted object type for bean '" + beanName + "': "
|
||||
+ 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");
|
||||
* 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 : "");
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* <p>The default is {@link Format#PREFIX_ERROR_CODE}.
|
||||
@@ -119,15 +127,7 @@ public class DefaultMessageCodesResolver implements MessageCodesResolver, Serial
|
||||
* @see Format
|
||||
*/
|
||||
public void setMessageCodeFormatter(MessageCodeFormatter formatter) {
|
||||
this.formatter = (formatter == null ? DEFAULT_FORMATTER : 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;
|
||||
this.formatter = (formatter != null ? formatter : DEFAULT_FORMATTER);
|
||||
}
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ public class DefaultMessageCodesResolver implements MessageCodesResolver, Serial
|
||||
* object/field-specific code, a field-specific code, a plain error code.
|
||||
* <p>Arrays, Lists and Maps are resolved both for specific elements and
|
||||
* 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.
|
||||
* @return the list of codes
|
||||
*/
|
||||
@@ -208,14 +208,10 @@ public class DefaultMessageCodesResolver implements MessageCodesResolver, Serial
|
||||
|
||||
/**
|
||||
* Common message code formats.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @author Chris Beams
|
||||
* @since 3.2
|
||||
* @see 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.:
|
||||
|
||||
@@ -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");
|
||||
* 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 defaultMessage the default message to be used to resolve this message
|
||||
*/
|
||||
public FieldError(
|
||||
String objectName, String field, Object rejectedValue, boolean bindingFailure,
|
||||
public FieldError(String objectName, String field, Object rejectedValue, boolean bindingFailure,
|
||||
String[] codes, Object[] arguments, String 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");
|
||||
* 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}.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @since 10.03.2003
|
||||
* @see FieldError
|
||||
* @see DefaultMessageCodesResolver
|
||||
* @since 10.03.2003
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class ObjectError extends DefaultMessageSourceResolvable {
|
||||
|
||||
Reference in New Issue
Block a user