Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ Collection<Resource> generateSyntheticBean(BeanInfo bean, ReflectionRegistration

// Foo_Bean implements InjectableBean<T>
ClassCreator beanCreator = ClassCreator.builder().classOutput(classOutput).className(generatedName)
.interfaces(InjectableBean.class).build();
.interfaces(InjectableBean.class, Supplier.class).build();

// Fields
FieldCreator beanTypes = beanCreator.getFieldCreator(FIELD_NAME_BEAN_TYPES, Set.class)
Expand Down Expand Up @@ -195,6 +195,7 @@ Collection<Resource> generateSyntheticBean(BeanInfo bean, ReflectionRegistration
constructor.returnValue(null);

implementGetIdentifier(bean, beanCreator);
implementSupplierGet(beanCreator);
if (!bean.hasDefaultDestroy()) {
implementDestroy(bean, beanCreator, providerTypeName, Collections.emptyMap(), reflectionRegistration,
isApplicationClass, baseName);
Expand Down Expand Up @@ -246,7 +247,7 @@ Collection<Resource> generateClassBean(BeanInfo bean, ClassInfo beanClass, Refle

// Foo_Bean implements InjectableBean<T>
ClassCreator beanCreator = ClassCreator.builder().classOutput(classOutput).className(generatedName)
.interfaces(InjectableBean.class).build();
.interfaces(InjectableBean.class, Supplier.class).build();

// Fields
FieldCreator beanTypes = beanCreator.getFieldCreator(FIELD_NAME_BEAN_TYPES, Set.class)
Expand Down Expand Up @@ -275,6 +276,7 @@ Collection<Resource> generateClassBean(BeanInfo bean, ClassInfo beanClass, Refle
annotationLiterals);

implementGetIdentifier(bean, beanCreator);
implementSupplierGet(beanCreator);
if (!bean.hasDefaultDestroy()) {
implementDestroy(bean, beanCreator, providerTypeName, injectionPointToProviderSupplierField, reflectionRegistration,
isApplicationClass, baseName);
Expand Down Expand Up @@ -341,7 +343,7 @@ Collection<Resource> generateProducerMethodBean(BeanInfo bean, MethodInfo produc

// Foo_Bean implements InjectableBean<T>
ClassCreator beanCreator = ClassCreator.builder().classOutput(classOutput).className(generatedName)
.interfaces(InjectableBean.class).build();
.interfaces(InjectableBean.class, Supplier.class).build();

// Fields
FieldCreator beanTypes = beanCreator.getFieldCreator(FIELD_NAME_BEAN_TYPES, Set.class)
Expand Down Expand Up @@ -369,6 +371,7 @@ Collection<Resource> generateProducerMethodBean(BeanInfo bean, MethodInfo produc
annotationLiterals);

implementGetIdentifier(bean, beanCreator);
implementSupplierGet(beanCreator);
if (!bean.hasDefaultDestroy()) {
implementDestroy(bean, beanCreator, providerTypeName, injectionPointToProviderField, reflectionRegistration,
isApplicationClass, baseName);
Expand Down Expand Up @@ -426,7 +429,7 @@ Collection<Resource> generateProducerFieldBean(BeanInfo bean, FieldInfo producer

// Foo_Bean implements InjectableBean<T>
ClassCreator beanCreator = ClassCreator.builder().classOutput(classOutput).className(generatedName)
.interfaces(InjectableBean.class).build();
.interfaces(InjectableBean.class, Supplier.class).build();

// Fields
FieldCreator beanTypes = beanCreator.getFieldCreator(FIELD_NAME_BEAN_TYPES, Set.class)
Expand All @@ -450,6 +453,7 @@ Collection<Resource> generateProducerFieldBean(BeanInfo bean, FieldInfo producer
annotationLiterals);

implementGetIdentifier(bean, beanCreator);
implementSupplierGet(beanCreator);
if (!bean.hasDefaultDestroy()) {
implementDestroy(bean, beanCreator, providerTypeName, null, reflectionRegistration, isApplicationClass, baseName);
}
Expand Down Expand Up @@ -1514,6 +1518,11 @@ protected void implementGetName(BeanInfo bean, ClassCreator beanCreator) {
}
}

protected void implementSupplierGet(ClassCreator beanCreator) {
MethodCreator get = beanCreator.getMethodCreator("get", Object.class).setModifiers(ACC_PUBLIC);
get.returnValue(get.getThis());
}

private String getProxyTypeName(BeanInfo bean, String baseName) {
return getPackageName(bean) + "." + baseName + ClientProxyGenerator.CLIENT_PROXY_SUFFIX;
}
Expand Down
Loading