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 039aa27c42 ISIS-3167: obj. spec: memoize isInjectable flag 039aa27c42 is described below commit 039aa27c42a39eff515b584c4d56af24df4fe428 Author: Andi Huber <ahu...@apache.org> AuthorDate: Wed Aug 31 12:22:57 2022 +0200 ISIS-3167: obj. spec: memoize isInjectable flag --- .../specimpl/dflt/ObjectSpecificationDefault.java | 64 +++++++++++----------- 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/dflt/ObjectSpecificationDefault.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/dflt/ObjectSpecificationDefault.java index d2e2d0ccf6..e27ce87973 100644 --- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/dflt/ObjectSpecificationDefault.java +++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/dflt/ObjectSpecificationDefault.java @@ -75,8 +75,6 @@ public class ObjectSpecificationDefault extends ObjectSpecificationAbstract implements FacetHolder { - // -- constructor, fields - /** * Lazily built by {@link #getMember(Method)}. */ @@ -121,23 +119,6 @@ implements FacetHolder { new FacetedMethodsBuilder(this, facetProcessor, classSubstitutorRegistry); } - private boolean isVetoedForInjection; - - @Override - public boolean isInjectable() { - return !isVetoedForInjection - && !getBeanSort().isAbstract() - && !getBeanSort().isValue() - && !getBeanSort().isEntity() - && !getBeanSort().isViewModel() - && !getBeanSort().isMixin() - && (getBeanSort().isManagedBeanAny() - //|| typeMeta.getBeanSort().isUnknown()); - || getServiceRegistry() - .lookupRegisteredBeanById(getLogicalType()) - .isPresent()); - } - @Override protected void introspectTypeHierarchy() { @@ -339,18 +320,6 @@ implements FacetHolder { }); } - - // -- toString - - @Override - public String toString() { - final ToString str = new ToString(this); - str.append("class", getFullIdentifier()); - str.append("type", getBeanSort().name()); - str.append("superclass", superclass() == null ? "Object" : superclass().getFullIdentifier()); - return str.toString(); - } - // -- ELEMENT SPECIFICATION private final _Lazy<Optional<ObjectSpecification>> elementSpecification = @@ -377,4 +346,37 @@ implements FacetHolder { .streamPropertiesForColumnRendering(this, memberIdentifier, parentObject); } + // -- DETERMINE INJECTABILITY + + private boolean isVetoedForInjection; + + private _Lazy<Boolean> isInjectableLazy = _Lazy.threadSafe(()-> + !isVetoedForInjection + && !getBeanSort().isAbstract() + && !getBeanSort().isValue() + && !getBeanSort().isEntity() + && !getBeanSort().isViewModel() + && !getBeanSort().isMixin() + && (getBeanSort().isManagedBeanAny() + || getServiceRegistry() + .lookupRegisteredBeanById(getLogicalType()) + .isPresent()) + ); + + @Override + public boolean isInjectable() { + return isInjectableLazy.get(); + } + + // -- TO STRING + + @Override + public String toString() { + final ToString str = new ToString(this); + str.append("class", getFullIdentifier()); + str.append("type", getBeanSort().name()); + str.append("superclass", superclass() == null ? "Object" : superclass().getFullIdentifier()); + return str.toString(); + } + }