You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2020/01/04 17:00:25 UTC
[isis] branch master updated: ISIS-2158: allows reuse of
IsisBeanTypeRegistry's isToBeInspected logic
This is an automated email from the ASF dual-hosted git repository.
ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git
The following commit(s) were added to refs/heads/master by this push:
new 092049d ISIS-2158: allows reuse of IsisBeanTypeRegistry's isToBeInspected logic
092049d is described below
commit 092049d39b770f099d2b0e86979d275d18ed70ea
Author: Andi Huber <ah...@apache.org>
AuthorDate: Sat Jan 4 18:00:14 2020 +0100
ISIS-2158: allows reuse of IsisBeanTypeRegistry's isToBeInspected logic
---
.../isis/config/beans/IsisBeanTypeRegistry.java | 43 ++++++++++++++--------
1 file changed, 28 insertions(+), 15 deletions(-)
diff --git a/core/config/src/main/java/org/apache/isis/config/beans/IsisBeanTypeRegistry.java b/core/config/src/main/java/org/apache/isis/config/beans/IsisBeanTypeRegistry.java
index 34855cd..1107a2b 100644
--- a/core/config/src/main/java/org/apache/isis/config/beans/IsisBeanTypeRegistry.java
+++ b/core/config/src/main/java/org/apache/isis/config/beans/IsisBeanTypeRegistry.java
@@ -26,6 +26,7 @@ import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
+import java.util.function.Consumer;
import javax.enterprise.inject.Vetoed;
@@ -106,12 +107,31 @@ public final class IsisBeanTypeRegistry implements IsisComponentScanInterceptor,
}
// -- FILTER
+
+ public void ifToBeInspectedThen(Class<?> type, Consumer<BeanSort> onInspectionRequired) {
+
+ val beanSort = quickClassify(type);
+
+ val isManagedObjectToBeInspected = !beanSort.isManagedBean()
+ && !beanSort.isUnknown();
+
+ val isManagedBeanToBeInspected = beanSort.isManagedBean()
+ && (findNearestAnnotation(type, DomainService.class).isPresent()
+ // || findNearestAnnotation(type, Service.class).isPresent()
+ );
+
+ val isToBeInspected = isManagedBeanToBeInspected || isManagedObjectToBeInspected;
+
+ if(isToBeInspected) {
+ onInspectionRequired.accept(beanSort);
+ }
+ }
+
@Override
public void intercept(TypeMetaData typeMeta) {
val type = typeMeta.getUnderlyingClass();
- val beanSort = quickClassify(type);
if(findNearestAnnotation(type, DomainObject.class).isPresent() ||
findNearestAnnotation(type, ViewModel.class).isPresent() ||
@@ -121,31 +141,24 @@ public final class IsisBeanTypeRegistry implements IsisComponentScanInterceptor,
typeMeta.setInjectable(false); // reject
} else {
- typeMeta.setBeanNameOverride(extractObjectType(typeMeta.getUnderlyingClass()).orElse(null));
+ typeMeta.setBeanNameOverride(extractObjectType(type).orElse(null));
}
-
- val isManagedBeanToBeInspected = beanSort.isManagedBean()
- && (findNearestAnnotation(type, DomainService.class).isPresent()
- // || findNearestAnnotation(type, Service.class).isPresent()
- );
-
- val isManagedObjectToBeInspected = !beanSort.isManagedBean()
- && !beanSort.isUnknown();
- val isToBeInspected = isManagedBeanToBeInspected || isManagedObjectToBeInspected;
-
- if(isToBeInspected) {
+ ifToBeInspectedThen(type, beanSort->{
+
addIntrospectableType(beanSort, typeMeta);
-
+
if(log.isDebugEnabled()) {
log.debug("to-be-inspected: {} [{}]",
type,
beanSort.name());
}
- }
+
+ });
}
+
/**
* If given type is part of the meta-model and is available for injection,
* returns the <em>Managed Bean's</em> name (id) as