This is an automated email from the ASF dual-hosted git repository.
ahuber pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/causeway.git
The following commit(s) were added to refs/heads/main by this push:
new 4d7aabbe646 CAUSEWAY-2445: removes superfluous annot.
(ApplicationFeature)
4d7aabbe646 is described below
commit 4d7aabbe646666e056b29428c70a395b11568569
Author: andi-huber <[email protected]>
AuthorDate: Fri Feb 20 06:11:43 2026 +0100
CAUSEWAY-2445: removes superfluous annot. (ApplicationFeature)
---
.../services/appfeat/ApplicationFeature.java | 23 +++++-----------
...ionOrAnyMatchingValueSemanticsFacetFactory.java | 7 ++---
.../appfeat/ApplicationFeatureDefault.java | 31 +++++++++-------------
3 files changed, 22 insertions(+), 39 deletions(-)
diff --git
a/api/applib/src/main/java/org/apache/causeway/applib/services/appfeat/ApplicationFeature.java
b/api/applib/src/main/java/org/apache/causeway/applib/services/appfeat/ApplicationFeature.java
index 6c32011d57f..d0b6f043f5a 100644
---
a/api/applib/src/main/java/org/apache/causeway/applib/services/appfeat/ApplicationFeature.java
+++
b/api/applib/src/main/java/org/apache/causeway/applib/services/appfeat/ApplicationFeature.java
@@ -23,18 +23,11 @@
import java.util.OptionalInt;
import java.util.SortedSet;
-import jakarta.inject.Named;
-
-import org.apache.causeway.applib.CausewayModuleApplib;
import org.apache.causeway.applib.annotation.SemanticsOf;
-import org.apache.causeway.applib.annotation.Value;
/**
- *
* @since 1.x revised for 2.0 {@index}
*/
-@Named(CausewayModuleApplib.NAMESPACE_SUDO + ".ApplicationFeature")
-@Value
public interface ApplicationFeature {
ApplicationFeatureId getFeatureId();
@@ -50,16 +43,12 @@ default String getFullyQualifiedName() {
Optional<ApplicationMemberSort> getMemberSort();
default SortedSet<ApplicationFeatureId> getMembersOfSort(final
ApplicationMemberSort memberSort) {
- switch (memberSort) {
- case PROPERTY:
- return getProperties();
- case COLLECTION:
- return getCollections();
- case ACTION:
- return getActions();
- default:
- return Collections.emptySortedSet();
- }
+ return switch (memberSort) {
+ case PROPERTY -> getProperties();
+ case COLLECTION -> getCollections();
+ case ACTION -> getActions();
+ default -> Collections.emptySortedSet();
+ };
}
/**
diff --git
a/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/facets/object/value/annotcfg/ValueFacetForValueAnnotationOrAnyMatchingValueSemanticsFacetFactory.java
b/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/facets/object/value/annotcfg/ValueFacetForValueAnnotationOrAnyMatchingValueSemanticsFacetFactory.java
index 1b9d0692484..232e0e984d1 100644
---
a/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/facets/object/value/annotcfg/ValueFacetForValueAnnotationOrAnyMatchingValueSemanticsFacetFactory.java
+++
b/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/facets/object/value/annotcfg/ValueFacetForValueAnnotationOrAnyMatchingValueSemanticsFacetFactory.java
@@ -110,10 +110,9 @@ private <T> Optional<ValueFacet<T>>
addAllFacetsForValueSemantics(
log.warn("could not find a ValueSemanticsProvider for value
type {}; "
+ "the type was found to be annotated with @Value",
valueClass);
// fall through, so gets a ValueFacet
- } else {
+ } else
// don't install a ValueFacet
return Optional.empty();
- }
} else {
log.debug("found {} ValueSemanticsProvider(s) for value type {}",
semanticsProviders.size(), valueClass);
}
@@ -138,7 +137,9 @@ public static <T> ValueFacet<T> installValueFacet(
FacetUtil.addFacetIfPresent(MaxLengthFacetFromValueFacet.create(valueFacet,
valueSpec));
FacetUtil.addFacetIfPresent(DefaultedFacetFromValueFacet.create(valueFacet,
valueSpec));
- _Assert.assertTrue(valueSpec.valueFacet().isPresent());
+ _Assert.assertTrue(valueSpec.valueFacet().isPresent(), ()->"value
facet not created for %s (provider-count=%d)"
+ .formatted(valueSpec.getCorrespondingClass().getName(),
+ valueSemanticsProviders.size()));
_Assert.assertTrue(valueSpec.lookupNonFallbackFacet(TitleFacet.class).isPresent());
_Assert.assertNotNull(Facets.valueSerializerElseFail(valueSpec,
valueSpec.getCorrespondingClass()));
diff --git
a/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/services/appfeat/ApplicationFeatureDefault.java
b/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/services/appfeat/ApplicationFeatureDefault.java
index e6d2151796a..52a9933d94f 100644
---
a/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/services/appfeat/ApplicationFeatureDefault.java
+++
b/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/services/appfeat/ApplicationFeatureDefault.java
@@ -23,10 +23,9 @@
import java.util.OptionalInt;
import java.util.SortedSet;
-import jakarta.inject.Named;
+import org.jspecify.annotations.NonNull;
import org.apache.causeway.applib.annotation.SemanticsOf;
-import org.apache.causeway.applib.annotation.Value;
import org.apache.causeway.applib.services.appfeat.ApplicationFeature;
import org.apache.causeway.applib.services.appfeat.ApplicationFeatureId;
import
org.apache.causeway.applib.services.appfeat.ApplicationFeatureRepository;
@@ -36,26 +35,21 @@
import org.apache.causeway.applib.util.ObjectContracts;
import org.apache.causeway.applib.util.ToString;
import org.apache.causeway.commons.internal.collections._Sets;
-import org.apache.causeway.core.metamodel.CausewayModuleCoreMetamodel;
import lombok.AccessLevel;
import lombok.Getter;
-import org.jspecify.annotations.NonNull;
import lombok.Setter;
/**
* Canonical application feature, identified by {@link ApplicationFeatureId},
* and wired together with other application features and cached by {@link
ApplicationFeatureRepository}.
*
- * <p>
- * Note that this is NOT a view model; instead it can be converted to a
string using methods of
- * {@link ApplicationFeatureRepository}.
- * </p>
+ * <p> Note that this is NOT a view model; instead it can be converted to a
string using methods of
+ * {@link ApplicationFeatureRepository}.
*
* @since 1.x revised for 2.0 {@index}
*/
-@Named(CausewayModuleCoreMetamodel.NAMESPACE +
".services.appfeat.ApplicationFeature")
-@Value
[email protected]
public class ApplicationFeatureDefault
implements
ApplicationFeature,
@@ -119,42 +113,41 @@ void addToContents(final ApplicationFeatureId contentId) {
void addToMembers(final ApplicationFeatureId memberId, final
ApplicationMemberSort memberSort) {
_Asserts.assertIsType(this.getFeatureId());
_Asserts.assertIsMember(memberId);
-
getMembersOfSort(memberSort).add(memberId);
}
// -- OBJECT CONTRACT
- private static final Comparator<ApplicationFeature> comparator =
+ private static final Comparator<ApplicationFeature> COMPARATOR =
Comparator.comparing(ApplicationFeature::getFeatureId);
- private static final Equality<ApplicationFeature> equality =
+ private static final Equality<ApplicationFeature> EQUALITY =
ObjectContracts.checkEquals(ApplicationFeature::getFeatureId);
- private static final Hashing<ApplicationFeature> hashing =
+ private static final Hashing<ApplicationFeature> HASHING =
ObjectContracts.hashing(ApplicationFeature::getFeatureId);
- private static final ToString<ApplicationFeature> toString =
+ private static final ToString<ApplicationFeature> TOSTRING =
ObjectContracts.toString("featureId",
ApplicationFeature::getFeatureId);
@Override
public int compareTo(final ApplicationFeature other) {
- return comparator.compare(this, other);
+ return COMPARATOR.compare(this, other);
}
@Override
public boolean equals(final Object obj) {
- return equality.equals(this, obj);
+ return EQUALITY.equals(this, obj);
}
@Override
public int hashCode() {
- return hashing.hashCode(this);
+ return HASHING.hashCode(this);
}
@Override
public String toString() {
- return toString.toString(this);
+ return TOSTRING.toString(this);
}
}