Polish
This commit is contained in:
parent
62d98685ce
commit
ad0573a91e
|
@ -21,7 +21,6 @@ import java.beans.IntrospectionException;
|
|||
import java.beans.Introspector;
|
||||
import java.beans.PropertyDescriptor;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
@ -138,7 +137,7 @@ class BeanDefinitionPropertiesCodeGenerator {
|
|||
}
|
||||
|
||||
private void addInitDestroyMethods(Builder builder,
|
||||
AbstractBeanDefinition beanDefinition, String[] methodNames, String format) {
|
||||
AbstractBeanDefinition beanDefinition, @Nullable String[] methodNames, String format) {
|
||||
|
||||
if (!ObjectUtils.isEmpty(methodNames)) {
|
||||
Class<?> beanType = ClassUtils
|
||||
|
@ -237,15 +236,6 @@ class BeanDefinitionPropertiesCodeGenerator {
|
|||
return Collections.unmodifiableMap(writeMethods);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private Method findWriteMethod(BeanInfo beanInfo, String propertyName) {
|
||||
return Arrays.stream(beanInfo.getPropertyDescriptors())
|
||||
.filter(pd -> propertyName.equals(pd.getName()))
|
||||
.map(java.beans.PropertyDescriptor::getWriteMethod)
|
||||
.filter(Objects::nonNull).findFirst().orElse(null);
|
||||
}
|
||||
|
||||
|
||||
private void addAttributes(CodeBlock.Builder builder, BeanDefinition beanDefinition) {
|
||||
String[] attributeNames = beanDefinition.attributeNames();
|
||||
if (!ObjectUtils.isEmpty(attributeNames)) {
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.springframework.lang.Nullable;
|
|||
* {@link org.springframework.beans.factory.aot.BeanRegistrationExcludeFilter}.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @author Stephane Nicoll
|
||||
* @since 6.0
|
||||
* @see BeanFactoryInitializationAotContribution
|
||||
*/
|
||||
|
@ -39,15 +40,14 @@ public interface BeanFactoryInitializationAotProcessor {
|
|||
* ahead-of-time and return a contribution or {@code null}.
|
||||
* <p>
|
||||
* Processors are free to use any techniques they like to analyze the given
|
||||
* instance. Most typically use reflection to find fields or methods to use
|
||||
* in the contribution. Contributions typically generate source code or
|
||||
* bean factory. Most typically use reflection to find fields or methods to
|
||||
* use in the contribution. Contributions typically generate source code or
|
||||
* resource files that can be used when the AOT optimized application runs.
|
||||
* <p>
|
||||
* If the given instance isn't relevant to the processor, it should return a
|
||||
* {@code null} contribution.
|
||||
* If the given bean factory does not contain anything that is relevant to
|
||||
* the processor, it should return a {@code null} contribution.
|
||||
* @param beanFactory the bean factory to process
|
||||
* @return a {@link BeanFactoryInitializationAotContribution} or
|
||||
* {@code null}
|
||||
* @return a {@link BeanFactoryInitializationAotContribution} or {@code null}
|
||||
*/
|
||||
@Nullable
|
||||
BeanFactoryInitializationAotContribution processAheadOfTime(
|
||||
|
|
|
@ -48,7 +48,7 @@ public interface BeanRegistrationAotContribution {
|
|||
|
||||
/**
|
||||
* Apply this contribution to the given {@link BeanRegistrationCode}.
|
||||
* @param generationContext the active generation context
|
||||
* @param generationContext the generation context
|
||||
* @param beanRegistrationCode the generated registration
|
||||
*/
|
||||
void applyTo(GenerationContext generationContext,
|
||||
|
@ -61,7 +61,7 @@ public interface BeanRegistrationAotContribution {
|
|||
* @param beanRegistrationCodeFragmentsCustomizer the
|
||||
* {@link BeanRegistrationCodeFragments} customizer
|
||||
* @return a new {@link BeanRegistrationAotContribution} instance
|
||||
* @see #customizeBeanRegistrationCodeFragments(BeanRegistrationCodeFragments)
|
||||
* @see #customizeBeanRegistrationCodeFragments(GenerationContext, BeanRegistrationCodeFragments)
|
||||
*/
|
||||
static BeanRegistrationAotContribution ofBeanRegistrationCodeFragmentsCustomizer(
|
||||
UnaryOperator<BeanRegistrationCodeFragments> beanRegistrationCodeFragmentsCustomizer) {
|
||||
|
|
|
@ -20,6 +20,7 @@ import org.springframework.aot.generate.MethodGenerator;
|
|||
import org.springframework.aot.generate.MethodReference;
|
||||
import org.springframework.beans.factory.support.InstanceSupplier;
|
||||
import org.springframework.javapoet.ClassName;
|
||||
import org.springframework.util.function.ThrowingBiFunction;
|
||||
|
||||
/**
|
||||
* Interface that can be used to configure the code that will be generated to
|
||||
|
@ -28,7 +29,6 @@ import org.springframework.javapoet.ClassName;
|
|||
* @author Phillip Webb
|
||||
* @since 6.0
|
||||
* @see BeanRegistrationCodeFragments
|
||||
* @see BeanRegistrationCodeFragmentsCustomizer
|
||||
*/
|
||||
public interface BeanRegistrationCode {
|
||||
|
||||
|
@ -50,7 +50,7 @@ public interface BeanRegistrationCode {
|
|||
* @param methodReference a reference to the post-process method to call.
|
||||
* The referenced method must have a functional signature compatible with
|
||||
* {@link InstanceSupplier#andThen}.
|
||||
* @see InstanceSupplier#andThen(org.springframework.util.function.ThrowableBiFunction)
|
||||
* @see InstanceSupplier#andThen(ThrowingBiFunction)
|
||||
*/
|
||||
void addInstancePostProcessor(MethodReference methodReference);
|
||||
|
||||
|
|
|
@ -35,8 +35,6 @@ import org.springframework.util.Assert;
|
|||
*
|
||||
* @author Phillip Webb
|
||||
* @since 6.0
|
||||
* @see BeanRegistrationCodeFragmentsWrapper
|
||||
* @see BeanRegistrationCodeFragmentsCustomizer
|
||||
*/
|
||||
public abstract class BeanRegistrationCodeFragments {
|
||||
|
||||
|
@ -55,7 +53,7 @@ public abstract class BeanRegistrationCodeFragments {
|
|||
|
||||
|
||||
protected BeanRegistrationCodeFragments(BeanRegistrationCodeFragments codeFragments) {
|
||||
Assert.notNull(codeFragments, "'codeFragments' must not be null");
|
||||
Assert.notNull(codeFragments, "CodeFragments must not be null");
|
||||
this.codeFragments = codeFragments;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue