Polish
This commit is contained in:
parent
e1c6860a41
commit
fda537d3b9
|
@ -149,7 +149,6 @@ class BeanDefinitionLoader {
|
|||
}
|
||||
|
||||
private int load(Package source) {
|
||||
// FIXME register the scanned package for data to pick up
|
||||
return this.scanner.scan(source.getName());
|
||||
}
|
||||
|
||||
|
|
|
@ -85,18 +85,10 @@ public class CustomPropertyConstructor extends Constructor {
|
|||
@Override
|
||||
protected Property getProperty(Class<?> type, String name)
|
||||
throws IntrospectionException {
|
||||
Property p = lookupProperty(type, name);
|
||||
|
||||
return p != null ? p : super.getProperty(type, name);
|
||||
}
|
||||
|
||||
private Property lookupProperty(Class<?> type, String name) {
|
||||
Map<String, Property> m = CustomPropertyConstructor.this.properties.get(type);
|
||||
|
||||
if (m != null) {
|
||||
return m.get(name);
|
||||
}
|
||||
return null;
|
||||
Map<String, Property> forType = CustomPropertyConstructor.this.properties
|
||||
.get(type);
|
||||
Property property = (forType == null ? null : forType.get(name));
|
||||
return (property == null ? super.getProperty(type, name) : property);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,7 +82,6 @@ public class PropertiesConfigurationFactory<T> implements FactoryBean<T>,
|
|||
|
||||
/**
|
||||
* Create a new factory for an object of the given type.
|
||||
*
|
||||
* @see #PropertiesConfigurationFactory(Class)
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
|
|
|
@ -44,12 +44,10 @@ public class PropertySourcesPropertyValues implements PropertyValues {
|
|||
|
||||
/**
|
||||
* Create a new PropertyValues from the given PropertySources
|
||||
*
|
||||
* @param propertySources a PropertySources instance
|
||||
*/
|
||||
public PropertySourcesPropertyValues(PropertySources propertySources) {
|
||||
this.propertySources = propertySources;
|
||||
// TODO: maybe lazy initialization?
|
||||
PropertySourcesPropertyResolver resolver = new PropertySourcesPropertyResolver(
|
||||
propertySources);
|
||||
for (PropertySource<?> source : propertySources) {
|
||||
|
@ -93,15 +91,11 @@ public class PropertySourcesPropertyValues implements PropertyValues {
|
|||
public PropertyValues changesSince(PropertyValues old) {
|
||||
MutablePropertyValues changes = new MutablePropertyValues();
|
||||
// for each property value in the new set
|
||||
for (PropertyValue newPv : getPropertyValues()) {
|
||||
for (PropertyValue newValue : getPropertyValues()) {
|
||||
// if there wasn't an old one, add it
|
||||
PropertyValue pvOld = old.getPropertyValue(newPv.getName());
|
||||
if (pvOld == null) {
|
||||
changes.addPropertyValue(newPv);
|
||||
}
|
||||
else if (!pvOld.equals(newPv)) {
|
||||
// it's changed
|
||||
changes.addPropertyValue(newPv);
|
||||
PropertyValue oldValue = old.getPropertyValue(newValue.getName());
|
||||
if (oldValue == null || !oldValue.equals(newValue)) {
|
||||
changes.addPropertyValue(newValue);
|
||||
}
|
||||
}
|
||||
return changes;
|
||||
|
|
|
@ -82,7 +82,6 @@ public class RelaxedDataBinder extends DataBinder {
|
|||
* map keys. Also creates new maps for properties of map type that are null (assuming
|
||||
* all maps are potentially nested). The standard bracket <code>[...]</code>
|
||||
* dereferencing is also accepted.
|
||||
*
|
||||
* @param propertyValues the property values
|
||||
* @param target the target object
|
||||
*/
|
||||
|
@ -146,7 +145,6 @@ public class RelaxedDataBinder extends DataBinder {
|
|||
* <li>Fuzzy matching can be employed for bean property names</li>
|
||||
* <li>Period separators can be used instead of indexing ([...]) for map keys</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param wrapper a bean wrapper for the object to bind
|
||||
* @param path the bean path to bind
|
||||
* @return a transformed path with correct bean wrapper syntax
|
||||
|
|
|
@ -30,8 +30,7 @@ public abstract class JsonParserFactory {
|
|||
|
||||
/**
|
||||
* Static factory for the "best" JSON parser available on the classpath. Tries Jackson
|
||||
* (2), then Snake YAML, and then falls back to the {@link SimpleJsonParser}.
|
||||
*
|
||||
* 2, then Snake YAML, and then falls back to the {@link SimpleJsonParser}.
|
||||
* @return a {@link JsonParser}
|
||||
*/
|
||||
public static JsonParser getJsonParser() {
|
||||
|
|
|
@ -72,7 +72,6 @@ public class YamlProcessor {
|
|||
* name=My Cool App
|
||||
* url=http://dev.bar.com
|
||||
* </pre>
|
||||
*
|
||||
* @param matchers a map of keys to value patterns (regular expressions)
|
||||
*/
|
||||
public void setDocumentMatchers(List<? extends DocumentMatcher> matchers) {
|
||||
|
@ -83,7 +82,6 @@ public class YamlProcessor {
|
|||
* Flag indicating that a document for which all the
|
||||
* {@link #setDocumentMatchers(List) document matchers} abstain will nevertheless
|
||||
* match.
|
||||
*
|
||||
* @param matchDefault the flag to set (default true)
|
||||
*/
|
||||
public void setMatchDefault(boolean matchDefault) {
|
||||
|
@ -94,7 +92,6 @@ public class YamlProcessor {
|
|||
* Method to use for resolving resources. Each resource will be converted to a Map, so
|
||||
* this property is used to decide which map entries to keep in the final output from
|
||||
* this factory.
|
||||
*
|
||||
* @param resolutionMethod the resolution method to set (defaults to
|
||||
* {@link ResolutionMethod#OVERRIDE}).
|
||||
*/
|
||||
|
@ -117,7 +114,6 @@ public class YamlProcessor {
|
|||
* into the callback, along with its representation as Properties. Depending on the
|
||||
* {@link #setResolutionMethod(ResolutionMethod)} not all of the documents will be
|
||||
* parsed.
|
||||
*
|
||||
* @param callback a callback to delegate to once matching documents are found
|
||||
*/
|
||||
protected void process(MatchCallback callback) {
|
||||
|
|
|
@ -63,7 +63,6 @@ public class YamlPropertySourceLoader extends PropertiesPropertySourceLoader {
|
|||
|
||||
/**
|
||||
* A property source loader that loads all properties and matches all documents.
|
||||
*
|
||||
* @return a property source loader
|
||||
*/
|
||||
public static YamlPropertySourceLoader matchAllLoader() {
|
||||
|
|
|
@ -54,7 +54,6 @@ public class ErrorPage {
|
|||
* The path to render (usually implemented as a forward), starting with "/". A custom
|
||||
* controller or servlet path can be used, or if the container supports it, a template
|
||||
* path (e.g. "/error.jsp").
|
||||
*
|
||||
* @return the path that will be rendered for this error
|
||||
*/
|
||||
public String getPath() {
|
||||
|
@ -70,7 +69,6 @@ public class ErrorPage {
|
|||
|
||||
/**
|
||||
* The HTTP status value that this error page matches.
|
||||
*
|
||||
* @return the status
|
||||
*/
|
||||
public HttpStatus getStatus() {
|
||||
|
@ -79,7 +77,6 @@ public class ErrorPage {
|
|||
|
||||
/**
|
||||
* The HTTP status value that this error page matches.
|
||||
*
|
||||
* @return the status value (or 0 for a page that matches any status)
|
||||
*/
|
||||
public int getStatusCode() {
|
||||
|
@ -88,8 +85,7 @@ public class ErrorPage {
|
|||
|
||||
/**
|
||||
* The exception type name.
|
||||
*
|
||||
* @return the exception type name (or null if there is none)
|
||||
* @return the exception type name (or {@code null} if there is none)
|
||||
*/
|
||||
public String getExceptionName() {
|
||||
return this.exception == null ? null : this.exception.getName();
|
||||
|
|
|
@ -83,7 +83,6 @@ public class JettyEmbeddedServletContainer implements EmbeddedServletContainer {
|
|||
}
|
||||
catch (InterruptedException ex) {
|
||||
Thread.currentThread().interrupt();
|
||||
// No drama
|
||||
}
|
||||
catch (Exception ex) {
|
||||
throw new EmbeddedServletContainerException(
|
||||
|
|
|
@ -274,7 +274,6 @@ public class JettyEmbeddedServletContainerFactory extends
|
|||
/**
|
||||
* Add {@link Configuration}s that will be applied to the {@link WebAppContext} before
|
||||
* the server is started.
|
||||
*
|
||||
* @param configurations the configurations to add
|
||||
*/
|
||||
public void addConfigurations(Configuration... configurations) {
|
||||
|
|
|
@ -332,8 +332,7 @@ public class TomcatEmbeddedServletContainerFactory extends
|
|||
}
|
||||
|
||||
/**
|
||||
* Add {@link LifecycleListener}s that should be applied to the Tomcat {@link Context}
|
||||
* .
|
||||
* Add {@link LifecycleListener}s that should be added to the Tomcat {@link Context}.
|
||||
* @param contextLifecycleListeners the listeners to add
|
||||
*/
|
||||
public void addContextLifecycleListeners(
|
||||
|
|
|
@ -76,15 +76,13 @@ public class ContextIdApplicationContextInitializer implements
|
|||
index);
|
||||
index = environment.getProperty("spring.application.index", Integer.class, index);
|
||||
if (index >= 0) {
|
||||
name = name + ":" + index;
|
||||
return name + ":" + index;
|
||||
}
|
||||
else {
|
||||
// FIXME do we want this
|
||||
String profiles = StringUtils.arrayToCommaDelimitedString(environment
|
||||
.getActiveProfiles());
|
||||
if (StringUtils.hasText(profiles)) {
|
||||
name = name + ":" + profiles;
|
||||
}
|
||||
|
||||
String profiles = StringUtils.arrayToCommaDelimitedString(environment
|
||||
.getActiveProfiles());
|
||||
if (StringUtils.hasText(profiles)) {
|
||||
name = name + ":" + profiles;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
|
|
@ -26,9 +26,8 @@ import java.lang.annotation.Target;
|
|||
* Annotation for externalized configuration. Add this to a class definition if you want
|
||||
* to bind and validate some external Properties (e.g. from a .properties file).
|
||||
*
|
||||
* @see ConfigurationPropertiesBindingPostProcessor
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @see ConfigurationPropertiesBindingPostProcessor
|
||||
*/
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
|
@ -39,7 +38,6 @@ public @interface ConfigurationProperties {
|
|||
* The (optional) name of the object to be bound. Properties to bind can have a name
|
||||
* prefix to select the properties that are valid to this object. Synonym for
|
||||
* {@link #name()}.
|
||||
*
|
||||
* @return the name prefix of the properties to bind
|
||||
*/
|
||||
String value() default "";
|
||||
|
@ -48,7 +46,6 @@ public @interface ConfigurationProperties {
|
|||
* The (optional) name of the object to be bound. Properties to bind can have a name
|
||||
* prefix to select the properties that are valid to this object. Synonym for
|
||||
* {@link #value()}.
|
||||
*
|
||||
* @return the name prefix of the properties to bind
|
||||
*/
|
||||
String name() default "";
|
||||
|
@ -57,7 +54,6 @@ public @interface ConfigurationProperties {
|
|||
* Flag to indicate that when binding to this object invalid fields should be ignored.
|
||||
* Invalid means invalid according to the binder that is used, and usually this means
|
||||
* fields of the wrong type (or that cannot be coerced into the correct type).
|
||||
*
|
||||
* @return the flag value (default false)
|
||||
*/
|
||||
boolean ignoreInvalidFields() default false;
|
||||
|
@ -65,7 +61,6 @@ public @interface ConfigurationProperties {
|
|||
/**
|
||||
* Flag to indicate that when binding to this object unknown fields should be ignored.
|
||||
* An unknown field could be a sign of a mistake in the Properties.
|
||||
*
|
||||
* @return the flag value (default true)
|
||||
*/
|
||||
boolean ignoreUnknownFields() default true;
|
||||
|
@ -73,7 +68,6 @@ public @interface ConfigurationProperties {
|
|||
/**
|
||||
* Optionally provide an explicit resource path to bind to instead of using the
|
||||
* default environment.
|
||||
*
|
||||
* @return the path (or paths) of resources to bind to
|
||||
*/
|
||||
String[] path() default {};
|
||||
|
|
Loading…
Reference in New Issue