Polishing
This commit is contained in:
@@ -318,7 +318,6 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp
|
|||||||
callable.call(this.currentBeanDefinition);
|
callable.call(this.currentBeanDefinition);
|
||||||
}
|
}
|
||||||
return this.currentBeanDefinition.getBeanDefinition();
|
return this.currentBeanDefinition.getBeanDefinition();
|
||||||
|
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
this.currentBeanDefinition = current;
|
this.currentBeanDefinition = current;
|
||||||
@@ -371,9 +370,9 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp
|
|||||||
}
|
}
|
||||||
else if ("ref".equals(name)) {
|
else if ("ref".equals(name)) {
|
||||||
String refName;
|
String refName;
|
||||||
if (args[0] == null)
|
if (args[0] == null) {
|
||||||
throw new IllegalArgumentException("Argument to ref() is not a valid bean or was not found");
|
throw new IllegalArgumentException("Argument to ref() is not a valid bean or was not found");
|
||||||
|
}
|
||||||
if (args[0] instanceof RuntimeBeanReference) {
|
if (args[0] instanceof RuntimeBeanReference) {
|
||||||
refName = ((RuntimeBeanReference) args[0]).getBeanName();
|
refName = ((RuntimeBeanReference) args[0]).getBeanName();
|
||||||
}
|
}
|
||||||
@@ -492,11 +491,11 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp
|
|||||||
Map.Entry factoryBeanEntry = (Map.Entry) ((Map) args[0]).entrySet().iterator().next();
|
Map.Entry factoryBeanEntry = (Map.Entry) ((Map) args[0]).entrySet().iterator().next();
|
||||||
// If we have a closure body, that will be the last argument.
|
// If we have a closure body, that will be the last argument.
|
||||||
// In between are the constructor args
|
// In between are the constructor args
|
||||||
int constructorArgsTest = hasClosureArgument?2:1;
|
int constructorArgsTest = (hasClosureArgument ? 2 : 1);
|
||||||
// If we have more than this number of args, we have constructor args
|
// If we have more than this number of args, we have constructor args
|
||||||
if (args.length > constructorArgsTest){
|
if (args.length > constructorArgsTest){
|
||||||
// factory-method requires args
|
// factory-method requires args
|
||||||
int endOfConstructArgs = (hasClosureArgument? args.length - 1 : args.length);
|
int endOfConstructArgs = (hasClosureArgument ? args.length - 1 : args.length);
|
||||||
this.currentBeanDefinition = new GroovyBeanDefinitionWrapper(beanName, null,
|
this.currentBeanDefinition = new GroovyBeanDefinitionWrapper(beanName, null,
|
||||||
resolveConstructorArguments(args, 1, endOfConstructArgs));
|
resolveConstructorArguments(args, 1, endOfConstructArgs));
|
||||||
}
|
}
|
||||||
@@ -514,7 +513,7 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
List constructorArgs = resolveConstructorArguments(args, 0, hasClosureArgument ? args.length - 1 : args.length);
|
List constructorArgs = resolveConstructorArguments(args, 0, hasClosureArgument ? args.length - 1 : args.length);
|
||||||
currentBeanDefinition = new GroovyBeanDefinitionWrapper(beanName, null, constructorArgs);
|
this.currentBeanDefinition = new GroovyBeanDefinitionWrapper(beanName, null, constructorArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasClosureArgument) {
|
if (hasClosureArgument) {
|
||||||
@@ -633,7 +632,7 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This method overrides property retrieval in the scope of the
|
* This method overrides property retrieval in the scope of the
|
||||||
* {@code GroovyBeanDefinitionReader} to either:
|
* {@code GroovyBeanDefinitionReader}. A property retrieval will either:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>Retrieve a variable from the bean builder's binding if it exists
|
* <li>Retrieve a variable from the bean builder's binding if it exists
|
||||||
* <li>Retrieve a RuntimeBeanReference for a specific bean if it exists
|
* <li>Retrieve a RuntimeBeanReference for a specific bean if it exists
|
||||||
@@ -684,8 +683,8 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp
|
|||||||
}
|
}
|
||||||
|
|
||||||
private GroovyDynamicElementReader createDynamicElementReader(String namespace) {
|
private GroovyDynamicElementReader createDynamicElementReader(String namespace) {
|
||||||
XmlReaderContext readerContext = this.groovyDslXmlBeanDefinitionReader.createReaderContext(new DescriptiveResource(
|
XmlReaderContext readerContext = this.groovyDslXmlBeanDefinitionReader.createReaderContext(
|
||||||
"Groovy"));
|
new DescriptiveResource("Groovy"));
|
||||||
BeanDefinitionParserDelegate delegate = new BeanDefinitionParserDelegate(readerContext);
|
BeanDefinitionParserDelegate delegate = new BeanDefinitionParserDelegate(readerContext);
|
||||||
boolean decorating = (this.currentBeanDefinition != null);
|
boolean decorating = (this.currentBeanDefinition != null);
|
||||||
if (!decorating) {
|
if (!decorating) {
|
||||||
@@ -779,7 +778,7 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wraps a bean definition property an ensures that any RuntimeBeanReference
|
* Wraps a bean definition property and ensures that any RuntimeBeanReference
|
||||||
* additions to it are deferred for resolution later.
|
* additions to it are deferred for resolution later.
|
||||||
*/
|
*/
|
||||||
private class GroovyPropertyValue extends GroovyObjectSupport {
|
private class GroovyPropertyValue extends GroovyObjectSupport {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2018 the original author or authors.
|
* Copyright 2002-2019 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,8 +41,8 @@ import org.springframework.util.ObjectUtils;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Decorator for a standard {@link BeanInfo} object, e.g. as created by
|
* Decorator for a standard {@link BeanInfo} object, e.g. as created by
|
||||||
* {@link Introspector#getBeanInfo(Class)}, designed to discover and register static
|
* {@link Introspector#getBeanInfo(Class)}, designed to discover and register
|
||||||
* and/or non-void returning setter methods. For example:
|
* static and/or non-void returning setter methods. For example:
|
||||||
*
|
*
|
||||||
* <pre class="code">
|
* <pre class="code">
|
||||||
* public class Bean {
|
* public class Bean {
|
||||||
@@ -216,7 +216,7 @@ class ExtendedBeanInfo implements BeanInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String propertyNameFor(Method method) {
|
private String propertyNameFor(Method method) {
|
||||||
return Introspector.decapitalize(method.getName().substring(3, method.getName().length()));
|
return Introspector.decapitalize(method.getName().substring(3));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -464,7 +464,7 @@ class ExtendedBeanInfo implements BeanInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* See java.beans.IndexedPropertyDescriptor#equals(java.lang.Object)
|
* See java.beans.IndexedPropertyDescriptor#equals
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object other) {
|
public boolean equals(Object other) {
|
||||||
|
|||||||
@@ -622,6 +622,7 @@ public class DefaultSingletonBeanRegistry extends SimpleAliasRegistry implements
|
|||||||
* should <i>not</i> have their own mutexes involved in singleton creation,
|
* should <i>not</i> have their own mutexes involved in singleton creation,
|
||||||
* to avoid the potential for deadlocks in lazy-init situations.
|
* to avoid the potential for deadlocks in lazy-init situations.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public final Object getSingletonMutex() {
|
public final Object getSingletonMutex() {
|
||||||
return this.singletonObjects;
|
return this.singletonObjects;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ public class JCacheAspectSupport extends AbstractCacheInvoker implements Initial
|
|||||||
return this.cacheOperationSource;
|
return this.cacheOperationSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void afterPropertiesSet() {
|
public void afterPropertiesSet() {
|
||||||
Assert.state(getCacheOperationSource() != null, "The 'cacheOperationSource' property is required: " +
|
Assert.state(getCacheOperationSource() != null, "The 'cacheOperationSource' property is required: " +
|
||||||
"If there are no cacheable methods, then don't use a cache aspect.");
|
"If there are no cacheable methods, then don't use a cache aspect.");
|
||||||
|
|||||||
Reference in New Issue
Block a user