Polishing
This commit is contained in:
parent
99d39eb2ee
commit
db7d71503d
|
|
@ -24,7 +24,8 @@ import org.springframework.util.ObjectUtils;
|
|||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Models a simple mail message, including data such as the from, to, cc, subject, and text fields.
|
||||
* Models a simple mail message, including data such as the from, to, cc, subject,
|
||||
* and text fields.
|
||||
*
|
||||
* <p>Consider {@code JavaMailSender} and JavaMail {@code MimeMessages} for creating
|
||||
* more sophisticated messages, for example messages with attachments, special
|
||||
|
|
@ -179,10 +180,9 @@ public class SimpleMailMessage implements MailMessage, Serializable {
|
|||
/**
|
||||
* Copy the contents of this message to the given target message.
|
||||
* @param target the {@code MailMessage} to copy to
|
||||
* @throws IllegalArgumentException if the supplied {@code target} is {@code null}
|
||||
*/
|
||||
public void copyTo(MailMessage target) {
|
||||
Assert.notNull(target, "The 'target' message argument cannot be null");
|
||||
Assert.notNull(target, "'target' message argument must not be null");
|
||||
if (getFrom() != null) {
|
||||
target.setFrom(getFrom());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
@ -210,6 +210,39 @@ public class ResourceBundleMessageSourceTests {
|
|||
assertEquals("default value", ac.getMessage("code1", new Object[] {"value"}, "default {0}", Locale.ENGLISH));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDefaultApplicationContextMessageSourceWithParent() {
|
||||
GenericApplicationContext ac = new GenericApplicationContext();
|
||||
GenericApplicationContext parent = new GenericApplicationContext();
|
||||
parent.refresh();
|
||||
ac.setParent(parent);
|
||||
ac.refresh();
|
||||
assertEquals("default", ac.getMessage("code1", null, "default", Locale.ENGLISH));
|
||||
assertEquals("default value", ac.getMessage("code1", new Object[] {"value"}, "default {0}", Locale.ENGLISH));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStaticApplicationContextMessageSourceWithStaticParent() {
|
||||
StaticApplicationContext ac = new StaticApplicationContext();
|
||||
StaticApplicationContext parent = new StaticApplicationContext();
|
||||
parent.refresh();
|
||||
ac.setParent(parent);
|
||||
ac.refresh();
|
||||
assertEquals("default", ac.getMessage("code1", null, "default", Locale.ENGLISH));
|
||||
assertEquals("default value", ac.getMessage("code1", new Object[] {"value"}, "default {0}", Locale.ENGLISH));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStaticApplicationContextMessageSourceWithDefaultParent() {
|
||||
StaticApplicationContext ac = new StaticApplicationContext();
|
||||
GenericApplicationContext parent = new GenericApplicationContext();
|
||||
parent.refresh();
|
||||
ac.setParent(parent);
|
||||
ac.refresh();
|
||||
assertEquals("default", ac.getMessage("code1", null, "default", Locale.ENGLISH));
|
||||
assertEquals("default value", ac.getMessage("code1", new Object[] {"value"}, "default {0}", Locale.ENGLISH));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResourceBundleMessageSourceStandalone() {
|
||||
ResourceBundleMessageSource ms = new ResourceBundleMessageSource();
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
@ -150,7 +150,7 @@ public class StandardAnnotationMetadata extends StandardClassMetadata implements
|
|||
public Set<MethodMetadata> getAnnotatedMethods(String annotationName) {
|
||||
try {
|
||||
Method[] methods = getIntrospectedClass().getDeclaredMethods();
|
||||
Set<MethodMetadata> annotatedMethods = new LinkedHashSet<MethodMetadata>();
|
||||
Set<MethodMetadata> annotatedMethods = new LinkedHashSet<MethodMetadata>(4);
|
||||
for (Method method : methods) {
|
||||
if (!method.isBridge() && method.getAnnotations().length > 0 &&
|
||||
AnnotatedElementUtils.isAnnotated(method, annotationName)) {
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
@ -77,12 +77,13 @@ public class MethodMetadataReadingVisitor extends MethodVisitor implements Metho
|
|||
|
||||
@Override
|
||||
public AnnotationVisitor visitAnnotation(final String desc, boolean visible) {
|
||||
String className = Type.getType(desc).getClassName();
|
||||
this.methodMetadataSet.add(this);
|
||||
String className = Type.getType(desc).getClassName();
|
||||
return new AnnotationAttributesReadingVisitor(
|
||||
className, this.attributesMap, this.metaAnnotationMap, this.classLoader);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getMethodName() {
|
||||
return this.methodName;
|
||||
|
|
|
|||
Loading…
Reference in New Issue