Skip to content

Commit 0ba91ec

Browse files
committed
CAUSEWAY-3859: flattens ManagedObjectEmpty into a record
1 parent 77633e6 commit 0ba91ec

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

core/metamodel/src/main/java/org/apache/causeway/core/metamodel/object/ManagedObject.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ static ManagedObject unspecified() {
407407
* @see ManagedObject.Specialization.PojoPolicy#NO_POJO
408408
*/
409409
static ManagedObject empty(final @NonNull ObjectSpecification spec) {
410-
return new _ManagedObjectEmpty(spec);
410+
return new ManagedObjectEmpty(spec);
411411
}
412412
/**
413413
* VALUE

core/metamodel/src/main/java/org/apache/causeway/core/metamodel/object/_ManagedObjectEmpty.java core/metamodel/src/main/java/org/apache/causeway/core/metamodel/object/ManagedObjectEmpty.java

+15-6
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,21 @@
1818
*/
1919
package org.apache.causeway.core.metamodel.object;
2020

21+
import org.jspecify.annotations.NonNull;
22+
2123
import org.apache.causeway.core.metamodel.spec.ObjectSpecification;
2224

2325
/**
2426
* (package private) specialization corresponding to {@link Specialization#EMPTY}
2527
* @see ManagedObject.Specialization#EMPTY
2628
*/
27-
final class _ManagedObjectEmpty
28-
extends _ManagedObjectSpecified
29-
implements Bookmarkable.NoBookmark {
29+
record ManagedObjectEmpty(
30+
@NonNull ObjectSpecification objSpec)
31+
implements ManagedObject, Bookmarkable.NoBookmark {
3032

31-
_ManagedObjectEmpty(
32-
final ObjectSpecification spec) {
33-
super(ManagedObject.Specialization.EMPTY, spec);
33+
@Override
34+
public Specialization specialization() {
35+
return ManagedObject.Specialization.EMPTY;
3436
}
3537

3638
@Override
@@ -43,4 +45,11 @@ public String getTitle() {
4345
return "empty " + objSpec().logicalTypeName();
4446
}
4547

48+
// -- HELPER
49+
50+
@Override
51+
public <T> T assertCompliance(@NonNull final T pojo) {
52+
return null; // no-op
53+
}
54+
4655
}

0 commit comments

Comments
 (0)