Browse Source

Polishing

pull/24823/head
Sam Brannen 6 years ago
parent
commit
53106d5741
  1. 23
      spring-beans/src/main/java/org/springframework/beans/factory/BeanFactory.java
  2. 10
      spring-beans/src/main/java/org/springframework/beans/factory/config/BeanDefinition.java

23
spring-beans/src/main/java/org/springframework/beans/factory/BeanFactory.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2019 the original author or authors. * Copyright 2002-2020 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.
@ -22,7 +22,8 @@ import org.springframework.lang.Nullable;
/** /**
* The root interface for accessing a Spring bean container. * The root interface for accessing a Spring bean container.
* This is the basic client view of a bean container; *
* <p>This is the basic client view of a bean container;
* further interfaces such as {@link ListableBeanFactory} and * further interfaces such as {@link ListableBeanFactory} and
* {@link org.springframework.beans.factory.config.ConfigurableBeanFactory} * {@link org.springframework.beans.factory.config.ConfigurableBeanFactory}
* are available for specific purposes. * are available for specific purposes.
@ -130,7 +131,7 @@ public interface BeanFactory {
* Singleton or Prototype design pattern. Callers may retain references to * Singleton or Prototype design pattern. Callers may retain references to
* returned objects in the case of Singleton beans. * returned objects in the case of Singleton beans.
* <p>Translates aliases back to the corresponding canonical bean name. * <p>Translates aliases back to the corresponding canonical bean name.
* Will ask the parent factory if the bean cannot be found in this factory instance. * <p>Will ask the parent factory if the bean cannot be found in this factory instance.
* @param name the name of the bean to retrieve * @param name the name of the bean to retrieve
* @return an instance of the bean * @return an instance of the bean
* @throws NoSuchBeanDefinitionException if there is no bean with the specified name * @throws NoSuchBeanDefinitionException if there is no bean with the specified name
@ -145,7 +146,7 @@ public interface BeanFactory {
* required type. This means that ClassCastException can't be thrown on casting * required type. This means that ClassCastException can't be thrown on casting
* the result correctly, as can happen with {@link #getBean(String)}. * the result correctly, as can happen with {@link #getBean(String)}.
* <p>Translates aliases back to the corresponding canonical bean name. * <p>Translates aliases back to the corresponding canonical bean name.
* Will ask the parent factory if the bean cannot be found in this factory instance. * <p>Will ask the parent factory if the bean cannot be found in this factory instance.
* @param name the name of the bean to retrieve * @param name the name of the bean to retrieve
* @param requiredType type the bean must match; can be an interface or superclass * @param requiredType type the bean must match; can be an interface or superclass
* @return an instance of the bean * @return an instance of the bean
@ -258,7 +259,7 @@ public interface BeanFactory {
* to a scoped bean as well. Use the {@link #isPrototype} operation to explicitly * to a scoped bean as well. Use the {@link #isPrototype} operation to explicitly
* check for independent instances. * check for independent instances.
* <p>Translates aliases back to the corresponding canonical bean name. * <p>Translates aliases back to the corresponding canonical bean name.
* Will ask the parent factory if the bean cannot be found in this factory instance. * <p>Will ask the parent factory if the bean cannot be found in this factory instance.
* @param name the name of the bean to query * @param name the name of the bean to query
* @return whether this bean corresponds to a singleton instance * @return whether this bean corresponds to a singleton instance
* @throws NoSuchBeanDefinitionException if there is no bean with the given name * @throws NoSuchBeanDefinitionException if there is no bean with the given name
@ -275,7 +276,7 @@ public interface BeanFactory {
* to a scoped bean as well. Use the {@link #isSingleton} operation to explicitly * to a scoped bean as well. Use the {@link #isSingleton} operation to explicitly
* check for a shared singleton instance. * check for a shared singleton instance.
* <p>Translates aliases back to the corresponding canonical bean name. * <p>Translates aliases back to the corresponding canonical bean name.
* Will ask the parent factory if the bean cannot be found in this factory instance. * <p>Will ask the parent factory if the bean cannot be found in this factory instance.
* @param name the name of the bean to query * @param name the name of the bean to query
* @return whether this bean will always deliver independent instances * @return whether this bean will always deliver independent instances
* @throws NoSuchBeanDefinitionException if there is no bean with the given name * @throws NoSuchBeanDefinitionException if there is no bean with the given name
@ -290,7 +291,7 @@ public interface BeanFactory {
* More specifically, check whether a {@link #getBean} call for the given name * More specifically, check whether a {@link #getBean} call for the given name
* would return an object that is assignable to the specified target type. * would return an object that is assignable to the specified target type.
* <p>Translates aliases back to the corresponding canonical bean name. * <p>Translates aliases back to the corresponding canonical bean name.
* Will ask the parent factory if the bean cannot be found in this factory instance. * <p>Will ask the parent factory if the bean cannot be found in this factory instance.
* @param name the name of the bean to query * @param name the name of the bean to query
* @param typeToMatch the type to match against (as a {@code ResolvableType}) * @param typeToMatch the type to match against (as a {@code ResolvableType})
* @return {@code true} if the bean type matches, * @return {@code true} if the bean type matches,
@ -307,7 +308,7 @@ public interface BeanFactory {
* More specifically, check whether a {@link #getBean} call for the given name * More specifically, check whether a {@link #getBean} call for the given name
* would return an object that is assignable to the specified target type. * would return an object that is assignable to the specified target type.
* <p>Translates aliases back to the corresponding canonical bean name. * <p>Translates aliases back to the corresponding canonical bean name.
* Will ask the parent factory if the bean cannot be found in this factory instance. * <p>Will ask the parent factory if the bean cannot be found in this factory instance.
* @param name the name of the bean to query * @param name the name of the bean to query
* @param typeToMatch the type to match against (as a {@code Class}) * @param typeToMatch the type to match against (as a {@code Class})
* @return {@code true} if the bean type matches, * @return {@code true} if the bean type matches,
@ -326,7 +327,7 @@ public interface BeanFactory {
* as exposed by {@link FactoryBean#getObjectType()}. This may lead to the initialization * as exposed by {@link FactoryBean#getObjectType()}. This may lead to the initialization
* of a previously uninitialized {@code FactoryBean} (see {@link #getType(String, boolean)}). * of a previously uninitialized {@code FactoryBean} (see {@link #getType(String, boolean)}).
* <p>Translates aliases back to the corresponding canonical bean name. * <p>Translates aliases back to the corresponding canonical bean name.
* Will ask the parent factory if the bean cannot be found in this factory instance. * <p>Will ask the parent factory if the bean cannot be found in this factory instance.
* @param name the name of the bean to query * @param name the name of the bean to query
* @return the type of the bean, or {@code null} if not determinable * @return the type of the bean, or {@code null} if not determinable
* @throws NoSuchBeanDefinitionException if there is no bean with the given name * @throws NoSuchBeanDefinitionException if there is no bean with the given name
@ -345,7 +346,7 @@ public interface BeanFactory {
* {@code allowFactoryBeanInit} flag, this may lead to the initialization of a previously * {@code allowFactoryBeanInit} flag, this may lead to the initialization of a previously
* uninitialized {@code FactoryBean} if no early type information is available. * uninitialized {@code FactoryBean} if no early type information is available.
* <p>Translates aliases back to the corresponding canonical bean name. * <p>Translates aliases back to the corresponding canonical bean name.
* Will ask the parent factory if the bean cannot be found in this factory instance. * <p>Will ask the parent factory if the bean cannot be found in this factory instance.
* @param name the name of the bean to query * @param name the name of the bean to query
* @param allowFactoryBeanInit whether a {@code FactoryBean} may get initialized * @param allowFactoryBeanInit whether a {@code FactoryBean} may get initialized
* just for the purpose of determining its object type * just for the purpose of determining its object type
@ -360,7 +361,7 @@ public interface BeanFactory {
/** /**
* Return the aliases for the given bean name, if any. * Return the aliases for the given bean name, if any.
* All of those aliases point to the same bean when used in a {@link #getBean} call. * <p>All of those aliases point to the same bean when used in a {@link #getBean} call.
* <p>If the given name is an alias, the corresponding original bean name * <p>If the given name is an alias, the corresponding original bean name
* and other aliases (if any) will be returned, with the original bean name * and other aliases (if any) will be returned, with the original bean name
* being the first element in the array. * being the first element in the array.

10
spring-beans/src/main/java/org/springframework/beans/factory/config/BeanDefinition.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2019 the original author or authors. * Copyright 2002-2020 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.
@ -238,7 +238,7 @@ public interface BeanDefinition extends AttributeAccessor, BeanMetadataElement {
MutablePropertyValues getPropertyValues(); MutablePropertyValues getPropertyValues();
/** /**
* Return if there are property values values defined for this bean. * Return if there are property values defined for this bean.
* @since 5.0.2 * @since 5.0.2
*/ */
default boolean hasPropertyValues() { default boolean hasPropertyValues() {
@ -273,7 +273,7 @@ public interface BeanDefinition extends AttributeAccessor, BeanMetadataElement {
/** /**
* Set the role hint for this {@code BeanDefinition}. The role hint * Set the role hint for this {@code BeanDefinition}. The role hint
* provides the frameworks as well as tools with an indication of * provides the frameworks as well as tools an indication of
* the role and importance of a particular {@code BeanDefinition}. * the role and importance of a particular {@code BeanDefinition}.
* @since 5.1 * @since 5.1
* @see #ROLE_APPLICATION * @see #ROLE_APPLICATION
@ -284,7 +284,7 @@ public interface BeanDefinition extends AttributeAccessor, BeanMetadataElement {
/** /**
* Get the role hint for this {@code BeanDefinition}. The role hint * Get the role hint for this {@code BeanDefinition}. The role hint
* provides the frameworks as well as tools with an indication of * provides the frameworks as well as tools an indication of
* the role and importance of a particular {@code BeanDefinition}. * the role and importance of a particular {@code BeanDefinition}.
* @see #ROLE_APPLICATION * @see #ROLE_APPLICATION
* @see #ROLE_SUPPORT * @see #ROLE_SUPPORT
@ -347,7 +347,7 @@ public interface BeanDefinition extends AttributeAccessor, BeanMetadataElement {
/** /**
* Return the originating BeanDefinition, or {@code null} if none. * Return the originating BeanDefinition, or {@code null} if none.
* Allows for retrieving the decorated bean definition, if any. * <p>Allows for retrieving the decorated bean definition, if any.
* <p>Note that this method returns the immediate originator. Iterate through the * <p>Note that this method returns the immediate originator. Iterate through the
* originator chain to find the original BeanDefinition as defined by the user. * originator chain to find the original BeanDefinition as defined by the user.
*/ */

Loading…
Cancel
Save