Consistent bracket alignment
This commit is contained in:
@@ -378,7 +378,8 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
|
||||
if (pd.getReadMethod() != null || pd.getWriteMethod() != null) {
|
||||
return TypeDescriptor.nested(property(pd), tokens.keys.length);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if (pd.getReadMethod() != null || pd.getWriteMethod() != null) {
|
||||
return new TypeDescriptor(property(pd));
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ import org.springframework.util.ReflectionUtils;
|
||||
* {@link PropertyAccessor} implementation that directly accesses instance fields.
|
||||
* Allows for direct binding to fields instead of going through JavaBean setters.
|
||||
*
|
||||
* <p>Since 4.1 this implementation supports nested fields traversing.
|
||||
* <p>As of Spring 4.1, this implementation supports nested field traversal.
|
||||
*
|
||||
* <p>A DirectFieldAccessor's default for the "extractOldValueForEditor" setting
|
||||
* is "true", since a field can always be read without side effects.
|
||||
@@ -188,7 +188,6 @@ public class DirectFieldAccessor extends AbstractPropertyAccessor {
|
||||
|
||||
/**
|
||||
* Create a root {@link FieldAccessor}.
|
||||
*
|
||||
* @param canonicalName the full expression for the field to access
|
||||
* @param actualName the name of the local (root) property
|
||||
* @param field the field accessing the property
|
||||
@@ -212,13 +211,13 @@ public class DirectFieldAccessor extends AbstractPropertyAccessor {
|
||||
private final Field field;
|
||||
|
||||
/**
|
||||
* Create a new instance.
|
||||
* Create a new FieldAccessor instance.
|
||||
* @param parent the parent accessor, if any
|
||||
* @param canonicalName the full expression for the field to access
|
||||
* @param actualName the name of the partial expression for this property
|
||||
* @param field the field accessing the property
|
||||
*/
|
||||
private FieldAccessor(FieldAccessor parent, String canonicalName, String actualName, Field field) {
|
||||
public FieldAccessor(FieldAccessor parent, String canonicalName, String actualName, Field field) {
|
||||
Assert.notNull(canonicalName, "Expression must no be null");
|
||||
Assert.notNull(field, "Field must no be null");
|
||||
this.parents = buildParents(parent);
|
||||
@@ -229,7 +228,6 @@ public class DirectFieldAccessor extends AbstractPropertyAccessor {
|
||||
|
||||
/**
|
||||
* Create a child instance.
|
||||
*
|
||||
* @param actualName the name of the child property
|
||||
* @param field the field accessing the child property
|
||||
*/
|
||||
@@ -238,7 +236,7 @@ public class DirectFieldAccessor extends AbstractPropertyAccessor {
|
||||
}
|
||||
|
||||
public Field getField() {
|
||||
return field;
|
||||
return this.field;
|
||||
}
|
||||
|
||||
public Object getValue() {
|
||||
@@ -252,9 +250,8 @@ public class DirectFieldAccessor extends AbstractPropertyAccessor {
|
||||
try {
|
||||
this.field.set(localTarget, value);
|
||||
}
|
||||
catch (IllegalAccessException e) {
|
||||
throw new InvalidPropertyException(localTarget.getClass(), canonicalName,
|
||||
"Field is not accessible", e);
|
||||
catch (IllegalAccessException ex) {
|
||||
throw new InvalidPropertyException(localTarget.getClass(), canonicalName, "Field is not accessible", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -275,8 +272,8 @@ public class DirectFieldAccessor extends AbstractPropertyAccessor {
|
||||
localTarget = autoGrowIfNecessary(parent, parent.getParentValue(localTarget));
|
||||
if (localTarget == null) { // Could not traverse the graph any further
|
||||
throw new NullValueInNestedPathException(getRootClass(), parent.actualName,
|
||||
"Cannot access indexed value of property referenced in indexed " +
|
||||
"property path '" + getField().getName() + "': returned null");
|
||||
"Cannot access indexed value of property referenced in indexed property path '" +
|
||||
getField().getName() + "': returned null");
|
||||
}
|
||||
}
|
||||
return localTarget;
|
||||
@@ -287,10 +284,10 @@ public class DirectFieldAccessor extends AbstractPropertyAccessor {
|
||||
try {
|
||||
return type.newInstance();
|
||||
}
|
||||
catch (Exception e) {
|
||||
catch (Exception ex) {
|
||||
throw new NullValueInNestedPathException(getRootClass(), this.actualName,
|
||||
"Could not instantiate property type [" + type.getName() + "] to " +
|
||||
"auto-grow nested property path: " + e);
|
||||
"Could not instantiate property type [" + type.getName() +
|
||||
"] to auto-grow nested property path: " + ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,7 +308,6 @@ public class DirectFieldAccessor extends AbstractPropertyAccessor {
|
||||
}
|
||||
return parents;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2014 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.
|
||||
@@ -172,7 +172,8 @@ final class PropertyMatches {
|
||||
char t_j = s2.charAt(j - 1);
|
||||
if (s_i == t_j) {
|
||||
cost = 0;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
cost = 1;
|
||||
}
|
||||
d[i][j] = Math.min(Math.min(d[i - 1][j] + 1, d[i][j - 1] + 1),
|
||||
|
||||
@@ -316,12 +316,12 @@ class TypeConverterDelegate {
|
||||
convertedValue = enumField.get(null);
|
||||
}
|
||||
catch (ClassNotFoundException ex) {
|
||||
if(logger.isTraceEnabled()) {
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Enum class [" + enumType + "] cannot be loaded", ex);
|
||||
}
|
||||
}
|
||||
catch (Throwable ex) {
|
||||
if(logger.isTraceEnabled()) {
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Field [" + fieldName + "] isn't an enum value for type [" + enumType + "]", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1028,7 +1028,8 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
if (this.dependencyComparator instanceof OrderProviderComparator) {
|
||||
((OrderProviderComparator) this.dependencyComparator)
|
||||
.sortArray(items, createFactoryAwareOrderProvider(matchingBeans));
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
Arrays.sort(items, this.dependencyComparator);
|
||||
}
|
||||
}
|
||||
@@ -1037,7 +1038,8 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
if (this.dependencyComparator instanceof OrderProviderComparator) {
|
||||
((OrderProviderComparator) this.dependencyComparator)
|
||||
.sortList(items, createFactoryAwareOrderProvider(matchingBeans));
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
Collections.sort(items, this.dependencyComparator);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ public abstract class AbstractSimpleBeanDefinitionParser extends AbstractSingleB
|
||||
*/
|
||||
protected boolean isEligibleAttribute(Attr attribute, ParserContext parserContext) {
|
||||
boolean eligible = isEligibleAttribute(attribute);
|
||||
if(!eligible) {
|
||||
if (!eligible) {
|
||||
String fullName = attribute.getName();
|
||||
eligible = (!fullName.equals("xmlns") && !fullName.startsWith("xmlns:") &&
|
||||
isEligibleAttribute(parserContext.getDelegate().getLocalName(attribute)));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2014 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.
|
||||
@@ -13,29 +13,30 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.beans.factory.xml;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.config.BeanDefinitionHolder;
|
||||
import org.springframework.beans.factory.config.ConstructorArgumentValues;
|
||||
import org.springframework.beans.factory.config.RuntimeBeanReference;
|
||||
import org.springframework.beans.factory.config.ConstructorArgumentValues.ValueHolder;
|
||||
import org.springframework.core.Conventions;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.w3c.dom.Attr;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.config.BeanDefinitionHolder;
|
||||
import org.springframework.beans.factory.config.ConstructorArgumentValues;
|
||||
import org.springframework.beans.factory.config.ConstructorArgumentValues.ValueHolder;
|
||||
import org.springframework.beans.factory.config.RuntimeBeanReference;
|
||||
import org.springframework.core.Conventions;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Simple {@code NamespaceHandler} implementation that maps custom
|
||||
* attributes directly through to bean properties. An important point to note is
|
||||
* that this {@code NamespaceHandler} does not have a corresponding schema
|
||||
* since there is no way to know in advance all possible attribute names.
|
||||
*
|
||||
* <p>
|
||||
* An example of the usage of this {@code NamespaceHandler} is shown below:
|
||||
* <p>An example of the usage of this {@code NamespaceHandler} is shown below:
|
||||
*
|
||||
* <pre class="code">
|
||||
* <bean id="author" class="..TestBean" c:name="Enescu" c:work-ref="compositions"/>
|
||||
@@ -51,14 +52,17 @@ import org.w3c.dom.Node;
|
||||
* support for indexes or types. Further more, the names are used as hints by
|
||||
* the container which, by default, does type introspection.
|
||||
*
|
||||
* @see SimplePropertyNamespaceHandler
|
||||
* @author Costin Leau
|
||||
* @since 3.1
|
||||
* @see SimplePropertyNamespaceHandler
|
||||
*/
|
||||
public class SimpleConstructorNamespaceHandler implements NamespaceHandler {
|
||||
|
||||
private static final String REF_SUFFIX = "-ref";
|
||||
|
||||
private static final String DELIMITER_PREFIX = "_";
|
||||
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
}
|
||||
@@ -102,7 +106,8 @@ public class SimpleConstructorNamespaceHandler implements NamespaceHandler {
|
||||
int index = -1;
|
||||
try {
|
||||
index = Integer.parseInt(arg);
|
||||
} catch (NumberFormatException ex) {
|
||||
}
|
||||
catch (NumberFormatException ex) {
|
||||
parserContext.getReaderContext().error(
|
||||
"Constructor argument '" + argName + "' specifies an invalid integer", attr);
|
||||
}
|
||||
@@ -136,11 +141,8 @@ public class SimpleConstructorNamespaceHandler implements NamespaceHandler {
|
||||
}
|
||||
|
||||
private boolean containsArgWithName(String name, ConstructorArgumentValues cvs) {
|
||||
if (!checkName(name, cvs.getGenericArgumentValues())) {
|
||||
return checkName(name, cvs.getIndexedArgumentValues().values());
|
||||
}
|
||||
|
||||
return true;
|
||||
return (checkName(name, cvs.getGenericArgumentValues()) ||
|
||||
checkName(name, cvs.getIndexedArgumentValues().values()));
|
||||
}
|
||||
|
||||
private boolean checkName(String name, Collection<ValueHolder> values) {
|
||||
@@ -151,4 +153,5 @@ public class SimpleConstructorNamespaceHandler implements NamespaceHandler {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2014 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.
|
||||
@@ -16,13 +16,13 @@
|
||||
|
||||
package org.springframework.beans.propertyeditors;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.beans.PropertyEditorSupport;
|
||||
import java.util.Locale;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* {@link java.beans.PropertyEditor} implementation for
|
||||
* {@link java.util.ResourceBundle ResourceBundles}.
|
||||
@@ -87,7 +87,8 @@ public class ResourceBundleEditor extends PropertyEditorSupport {
|
||||
int indexOfBaseNameSeparator = rawBaseName.indexOf(BASE_NAME_SEPARATOR);
|
||||
if (indexOfBaseNameSeparator == -1) {
|
||||
bundle = ResourceBundle.getBundle(rawBaseName);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
// it potentially has locale information
|
||||
String baseName = rawBaseName.substring(0, indexOfBaseNameSeparator);
|
||||
if (!StringUtils.hasText(baseName)) {
|
||||
|
||||
Reference in New Issue
Block a user