You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@causeway.apache.org by da...@apache.org on 2023/03/28 22:25:10 UTC

[causeway] 01/02: CAUSEWAY-2485: wip - @DomainObject#introspection

This is an automated email from the ASF dual-hosted git repository.

danhaywood pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/causeway.git

commit cb4e34de80f427e2e771dc2c8a57836f60710beb
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Tue Mar 28 08:52:08 2023 +0100

    CAUSEWAY-2485: wip - @DomainObject#introspection
---
 .../objects/DomainObject/DomainObjectMenu.java     |  7 ++
 .../DomainObjectIntrospection.layout.xml           | 81 ++++++++++++++++++++++
 .../DomainObjectIntrospectionAnnotOpt.java         | 50 +++++++++++++
 .../DomainObjectIntrospectionAnnotOptSeeding.java  | 38 ++++++++++
 ...ObjectIntrospectionAnnotOptJpa-description.adoc | 10 +++
 .../jpa/DomainObjectIntrospectionAnnotOptJpa.java  | 81 ++++++++++++++++++++++
 ...mainObjectIntrospectionAnnotOptJpaEntities.java | 40 +++++++++++
 .../DomainObjectIntrospectionAnnotReqd.java        | 50 +++++++++++++
 .../DomainObjectIntrospectionAnnotReqdSeeding.java | 38 ++++++++++
 ...bjectIntrospectionAnnotReqdJpa-description.adoc | 10 +++
 .../jpa/DomainObjectIntrospectionAnnotReqdJpa.java | 81 ++++++++++++++++++++++
 ...ainObjectIntrospectionAnnotReqdJpaEntities.java | 40 +++++++++++
 .../DomainObjectIntrospectionEncapsulated.java     | 50 +++++++++++++
 ...mainObjectIntrospectionEncapsulatedSeeding.java | 38 ++++++++++
 ...ctIntrospectionEncapsulatedJpa-description.adoc | 10 +++
 .../DomainObjectIntrospectionEncapsulatedJpa.java  | 81 ++++++++++++++++++++++
 ...ObjectIntrospectionEncapsulatedJpaEntities.java | 40 +++++++++++
 .../src/main/java/demoapp/dom/menubars.layout.xml  |  1 +
 18 files changed, 746 insertions(+)

diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/DomainObjectMenu.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/DomainObjectMenu.java
index 31db208be5..5e407d45f2 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/DomainObjectMenu.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/DomainObjectMenu.java
@@ -34,6 +34,7 @@ import demoapp.dom.domain.objects.DomainObject.autoComplete.DomainObjectAutoComp
 import demoapp.dom.domain.objects.DomainObject.bounded.DomainObjectBoundingVm;
 import demoapp.dom.domain.objects.DomainObject.editing.DomainObjectEditingVm;
 import demoapp.dom.domain.objects.DomainObject.entityChangePublishing.DomainObjectEntityChangePublishingVm;
+import demoapp.dom.domain.objects.DomainObject.introspection.DomainObjectIntrospectionVm;
 import demoapp.dom.domain.objects.DomainObject.mixinMethod.DomainObjectMixinMethodVm;
 import demoapp.dom.domain.objects.DomainObject.nature.viewmodels.jaxbrefentity.StatefulVmJaxbRefsEntity;
 import demoapp.dom.domain.objects.DomainObject.nature.viewmodels.usingjaxb.StatefulVmUsingJaxb;
@@ -80,6 +81,12 @@ public class DomainObjectMenu {
         return new DomainObjectEntityChangePublishingVm();
     }
 
+    @Action(semantics = SemanticsOf.SAFE)
+    @ActionLayout(cssClassFa="fa-book", describedAs = "Control over introspection process")
+    public DomainObjectIntrospectionVm introspection(){
+        return new DomainObjectIntrospectionVm();
+    }
+
     @Action(semantics = SemanticsOf.SAFE)
     @ActionLayout(cssClassFa="fa-tools", describedAs = "For mixins, override the default method name")
     public DomainObjectMixinMethodVm mixinMethod() {
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/DomainObjectIntrospection.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/DomainObjectIntrospection.layout.xml
new file mode 100644
index 0000000000..691a0c6d47
--- /dev/null
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/DomainObjectIntrospection.layout.xml
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
+	license agreements. See the NOTICE file distributed with this work for additional
+	information regarding copyright ownership. The ASF licenses this file to
+	you under the Apache License, Version 2.0 (the "License"); you may not use
+	this file except in compliance with the License. You may obtain a copy of
+	the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
+	by applicable law or agreed to in writing, software distributed under the
+	License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+	OF ANY KIND, either express or implied. See the License for the specific
+	language governing permissions and limitations under the License. -->
+<bs3:grid
+        xsi:schemaLocation="https://causeway.apache.org/applib/layout/component https://causeway.apache.org/applib/layout/component/component.xsd   https://causeway.apache.org/applib/layout/grid/bootstrap3 https://causeway.apache.org/applib/layout/grid/bootstrap3/bootstrap3.xsd"
+        xmlns:bs3="https://causeway.apache.org/applib/layout/grid/bootstrap3"
+        xmlns:cpt="https://causeway.apache.org/applib/layout/component"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+	<bs3:row>
+		<bs3:col span="10" unreferencedActions="true">
+			<cpt:domainObject />
+		</bs3:col>
+		<bs3:col span="2">
+			<cpt:fieldSet name="" id="sources" />
+		</bs3:col>
+	</bs3:row>
+
+	<bs3:row>
+		<bs3:col span="6">
+			<bs3:tabGroup>
+				<bs3:tab name="General">
+					<bs3:row>
+						<bs3:col span="12">
+							<cpt:fieldSet name="General" id="general" >
+								<cpt:property id="name"/>
+								<cpt:property id="originalName"/>
+								<cpt:property id="initialCharacter"/>
+							</cpt:fieldSet>
+						</bs3:col>
+					</bs3:row>
+				</bs3:tab>
+				<bs3:tab name="Metadata">
+					<bs3:row>
+						<bs3:col span="12">
+							<cpt:fieldSet name="Metadata" id="metadata" >
+								<cpt:property id="id"/>
+								<cpt:property id="logicalTypeName"/>
+								<cpt:property id="version"/>
+							</cpt:fieldSet>
+						</bs3:col>
+					</bs3:row>
+				</bs3:tab>
+				<bs3:tab name="Other">
+					<bs3:row>
+						<bs3:col span="12">
+							<cpt:fieldSet name="Other" id="other" unreferencedProperties="true"/>
+						</bs3:col>
+					</bs3:row>
+				</bs3:tab>
+			</bs3:tabGroup>
+		</bs3:col>
+		<bs3:col span="6">
+			<cpt:fieldSet name="Description" id="description" >
+				<cpt:action id="clearHints" position="PANEL" />
+				<cpt:action id="rebuildMetamodel" position="PANEL"/>
+				<cpt:action id="downloadLayout"  position="PANEL_DROPDOWN"/>
+				<cpt:action id="inspectMetamodel"  position="PANEL_DROPDOWN"/>
+				<cpt:action id="downloadMetamodelXml"  position="PANEL_DROPDOWN"/>
+				<cpt:action id="downloadJdoMetamodel"  position="PANEL_DROPDOWN"/>
+				<cpt:action id="recentCommands"  position="PANEL_DROPDOWN"/>
+				<cpt:action id="recentExecutions"  position="PANEL_DROPDOWN"/>
+				<cpt:action id="recentAuditTrailEntries"  position="PANEL_DROPDOWN"/>
+				<cpt:action id="impersonateWithRoles"  position="PANEL_DROPDOWN"/>
+				<cpt:action id="openRestApi" position="PANEL_DROPDOWN" />
+				<cpt:property id="description"/>
+			</cpt:fieldSet>
+		</bs3:col>	</bs3:row>
+	<bs3:row>
+		<bs3:col span="12" unreferencedCollections="true"/>
+	</bs3:row>
+
+</bs3:grid>
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/annotOpt/DomainObjectIntrospectionAnnotOpt.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/annotOpt/DomainObjectIntrospectionAnnotOpt.java
new file mode 100644
index 0000000000..d2a736822f
--- /dev/null
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/annotOpt/DomainObjectIntrospectionAnnotOpt.java
@@ -0,0 +1,50 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package demoapp.dom.domain.objects.DomainObject.introspection.annotOpt;
+
+import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
+import demoapp.dom._infra.values.ValueHolder;
+
+import org.apache.causeway.applib.annotation.Editing;
+import org.apache.causeway.applib.annotation.Property;
+
+@SuppressWarnings("CdiManagedBeanInconsistencyInspection")
+public abstract class DomainObjectIntrospectionAnnotOpt
+        implements
+        HasAsciiDocDescription,
+        ValueHolder<String> {
+
+    public String title() {
+        return value();
+    }
+
+    @Override
+    public String value() {
+        return getName();
+    }
+
+    public abstract String getName();
+    public abstract void setName(String value);
+
+    @Property(editing = Editing.DISABLED, editingDisabledReason = "This property cannot be edited")
+    public abstract String getOriginalName();
+    public abstract void setOriginalName(String value);
+
+    public abstract Character getInitialCharacter();
+}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/annotOpt/DomainObjectIntrospectionAnnotOptSeeding.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/annotOpt/DomainObjectIntrospectionAnnotOptSeeding.java
new file mode 100644
index 0000000000..f28f8050e9
--- /dev/null
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/annotOpt/DomainObjectIntrospectionAnnotOptSeeding.java
@@ -0,0 +1,38 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package demoapp.dom.domain.objects.DomainObject.introspection.annotOpt;
+
+import demoapp.dom._infra.seed.SeedServiceAbstract;
+import demoapp.dom._infra.values.ValueHolderRepository;
+
+import javax.inject.Inject;
+
+import org.springframework.stereotype.Service;
+
+@Service
+public class DomainObjectIntrospectionAnnotOptSeeding
+extends SeedServiceAbstract {
+
+    @Inject
+    public DomainObjectIntrospectionAnnotOptSeeding(
+            ValueHolderRepository<String, ? extends DomainObjectIntrospectionAnnotOpt> entities) {
+        super(entities);
+    }
+
+}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/annotOpt/jpa/DomainObjectIntrospectionAnnotOptJpa-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/annotOpt/jpa/DomainObjectIntrospectionAnnotOptJpa-description.adoc
new file mode 100644
index 0000000000..afff1e85cc
--- /dev/null
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/annotOpt/jpa/DomainObjectIntrospectionAnnotOptJpa-description.adoc
@@ -0,0 +1,10 @@
+:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or ag [...]
+
+In this demo app, property editing has been disabled by default, but has been explicitly enabled for this class:
+
+[source,java,indent=0]
+.DomainObjectIntrospectionAnnotOptJpa.java
+----
+include::DomainObjectIntrospectionAnnotOptJpa.java[tags=class]
+----
+<.> xxx
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/annotOpt/jpa/DomainObjectIntrospectionAnnotOptJpa.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/annotOpt/jpa/DomainObjectIntrospectionAnnotOptJpa.java
new file mode 100644
index 0000000000..9362092c19
--- /dev/null
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/annotOpt/jpa/DomainObjectIntrospectionAnnotOptJpa.java
@@ -0,0 +1,81 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package demoapp.dom.domain.objects.DomainObject.introspection.annotOpt.jpa;
+
+import demoapp.dom.domain.objects.DomainObject.editing.DomainObjectEditing;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
+import javax.inject.Named;
+import javax.persistence.*;
+
+import org.apache.causeway.applib.annotation.DomainObject;
+import org.apache.causeway.applib.annotation.Editing;
+import org.apache.causeway.applib.annotation.Introspection;
+import org.apache.causeway.applib.annotation.Property;
+import org.apache.causeway.persistence.jpa.applib.integration.CausewayEntityListener;
+import org.springframework.context.annotation.Profile;
+
+@Profile("demo-jpa")
+//tag::class[]
+@Entity
+@Table(
+    schema = "demo",
+    name = "DomainObjectIntrospectionJpa"
+)
+@EntityListeners(CausewayEntityListener.class)
+@Named("demo.DomainObjectIntrospection")
+@DomainObject(
+        introspection = Introspection.ANNOTATION_REQUIRED
+)
+@NoArgsConstructor
+public class DomainObjectIntrospectionAnnotOptJpa extends DomainObjectEditing {
+    // ...
+//end::class[]
+
+    public DomainObjectIntrospectionAnnotOptJpa(String value) {
+        setName(value);
+        setOriginalName(value);
+    }
+
+    @Id
+    @GeneratedValue
+    private Long id;
+//tag::class[]
+
+    @Getter @Setter
+    private String name;                        // <.>
+
+    @Property(
+            editing = Editing.DISABLED,         // <.>
+            editingDisabledReason = "This property may not be edited"
+    )
+    @Getter @Setter
+    private String originalName;
+
+    public Character getInitialCharacter() {    // <.>
+        return getName().charAt(0);
+    }
+//end::class[]
+
+
+//tag::class[]
+}
+//end::class[]
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/annotOpt/jpa/DomainObjectIntrospectionAnnotOptJpaEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/annotOpt/jpa/DomainObjectIntrospectionAnnotOptJpaEntities.java
new file mode 100644
index 0000000000..7d2c58b1e3
--- /dev/null
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/annotOpt/jpa/DomainObjectIntrospectionAnnotOptJpaEntities.java
@@ -0,0 +1,40 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package demoapp.dom.domain.objects.DomainObject.introspection.annotOpt.jpa;
+
+import demoapp.dom._infra.values.ValueHolderRepository;
+
+import org.springframework.context.annotation.Profile;
+import org.springframework.stereotype.Service;
+
+@Profile("demo-jpa")
+@Service
+public class DomainObjectIntrospectionAnnotOptJpaEntities
+extends ValueHolderRepository<String, DomainObjectIntrospectionAnnotOptJpa> {
+
+    protected DomainObjectIntrospectionAnnotOptJpaEntities() {
+        super(DomainObjectIntrospectionAnnotOptJpa.class);
+    }
+
+    @Override
+    protected DomainObjectIntrospectionAnnotOptJpa newDetachedEntity(String value) {
+        return new DomainObjectIntrospectionAnnotOptJpa(value);
+    }
+
+}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/annotReqd/DomainObjectIntrospectionAnnotReqd.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/annotReqd/DomainObjectIntrospectionAnnotReqd.java
new file mode 100644
index 0000000000..3668b3abe3
--- /dev/null
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/annotReqd/DomainObjectIntrospectionAnnotReqd.java
@@ -0,0 +1,50 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package demoapp.dom.domain.objects.DomainObject.introspection.annotReqd;
+
+import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
+import demoapp.dom._infra.values.ValueHolder;
+
+import org.apache.causeway.applib.annotation.Editing;
+import org.apache.causeway.applib.annotation.Property;
+
+@SuppressWarnings("CdiManagedBeanInconsistencyInspection")
+public abstract class DomainObjectIntrospectionAnnotReqd
+        implements
+        HasAsciiDocDescription,
+        ValueHolder<String> {
+
+    public String title() {
+        return value();
+    }
+
+    @Override
+    public String value() {
+        return getName();
+    }
+
+    public abstract String getName();
+    public abstract void setName(String value);
+
+    @Property(editing = Editing.DISABLED, editingDisabledReason = "This property cannot be edited")
+    public abstract String getOriginalName();
+    public abstract void setOriginalName(String value);
+
+    public abstract Character getInitialCharacter();
+}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/annotReqd/DomainObjectIntrospectionAnnotReqdSeeding.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/annotReqd/DomainObjectIntrospectionAnnotReqdSeeding.java
new file mode 100644
index 0000000000..21c3e8a1b8
--- /dev/null
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/annotReqd/DomainObjectIntrospectionAnnotReqdSeeding.java
@@ -0,0 +1,38 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package demoapp.dom.domain.objects.DomainObject.introspection.annotReqd;
+
+import demoapp.dom._infra.seed.SeedServiceAbstract;
+import demoapp.dom._infra.values.ValueHolderRepository;
+
+import javax.inject.Inject;
+
+import org.springframework.stereotype.Service;
+
+@Service
+public class DomainObjectIntrospectionAnnotReqdSeeding
+extends SeedServiceAbstract {
+
+    @Inject
+    public DomainObjectIntrospectionAnnotReqdSeeding(
+            ValueHolderRepository<String, ? extends DomainObjectIntrospectionAnnotReqd> entities) {
+        super(entities);
+    }
+
+}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/annotReqd/jpa/DomainObjectIntrospectionAnnotReqdJpa-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/annotReqd/jpa/DomainObjectIntrospectionAnnotReqdJpa-description.adoc
new file mode 100644
index 0000000000..12b750fe63
--- /dev/null
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/annotReqd/jpa/DomainObjectIntrospectionAnnotReqdJpa-description.adoc
@@ -0,0 +1,10 @@
+:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or ag [...]
+
+In this demo app, property editing has been disabled by default, but has been explicitly enabled for this class:
+
+[source,java,indent=0]
+.DomainObjectIntrospectionAnnotReqdJpa.java
+----
+include::DomainObjectIntrospectionAnnotReqdJpa.java[tags=class]
+----
+<.> xxx
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/annotReqd/jpa/DomainObjectIntrospectionAnnotReqdJpa.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/annotReqd/jpa/DomainObjectIntrospectionAnnotReqdJpa.java
new file mode 100644
index 0000000000..f125a9dcb2
--- /dev/null
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/annotReqd/jpa/DomainObjectIntrospectionAnnotReqdJpa.java
@@ -0,0 +1,81 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package demoapp.dom.domain.objects.DomainObject.introspection.annotReqd.jpa;
+
+import demoapp.dom.domain.objects.DomainObject.editing.DomainObjectEditing;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
+import javax.inject.Named;
+import javax.persistence.*;
+
+import org.apache.causeway.applib.annotation.DomainObject;
+import org.apache.causeway.applib.annotation.Editing;
+import org.apache.causeway.applib.annotation.Introspection;
+import org.apache.causeway.applib.annotation.Property;
+import org.apache.causeway.persistence.jpa.applib.integration.CausewayEntityListener;
+import org.springframework.context.annotation.Profile;
+
+@Profile("demo-jpa")
+//tag::class[]
+@Entity
+@Table(
+    schema = "demo",
+    name = "DomainObjectIntrospectionJpa"
+)
+@EntityListeners(CausewayEntityListener.class)
+@Named("demo.DomainObjectIntrospection")
+@DomainObject(
+        introspection = Introspection.ANNOTATION_REQUIRED
+)
+@NoArgsConstructor
+public class DomainObjectIntrospectionAnnotReqdJpa extends DomainObjectEditing {
+    // ...
+//end::class[]
+
+    public DomainObjectIntrospectionAnnotReqdJpa(String value) {
+        setName(value);
+        setOriginalName(value);
+    }
+
+    @Id
+    @GeneratedValue
+    private Long id;
+//tag::class[]
+
+    @Getter @Setter
+    private String name;                        // <.>
+
+    @Property(
+            editing = Editing.DISABLED,         // <.>
+            editingDisabledReason = "This property may not be edited"
+    )
+    @Getter @Setter
+    private String originalName;
+
+    public Character getInitialCharacter() {    // <.>
+        return getName().charAt(0);
+    }
+//end::class[]
+
+
+//tag::class[]
+}
+//end::class[]
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/annotReqd/jpa/DomainObjectIntrospectionAnnotReqdJpaEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/annotReqd/jpa/DomainObjectIntrospectionAnnotReqdJpaEntities.java
new file mode 100644
index 0000000000..23497ca98b
--- /dev/null
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/annotReqd/jpa/DomainObjectIntrospectionAnnotReqdJpaEntities.java
@@ -0,0 +1,40 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package demoapp.dom.domain.objects.DomainObject.introspection.annotReqd.jpa;
+
+import demoapp.dom._infra.values.ValueHolderRepository;
+
+import org.springframework.context.annotation.Profile;
+import org.springframework.stereotype.Service;
+
+@Profile("demo-jpa")
+@Service
+public class DomainObjectIntrospectionAnnotReqdJpaEntities
+extends ValueHolderRepository<String, DomainObjectIntrospectionAnnotReqdJpa> {
+
+    protected DomainObjectIntrospectionAnnotReqdJpaEntities() {
+        super(DomainObjectIntrospectionAnnotReqdJpa.class);
+    }
+
+    @Override
+    protected DomainObjectIntrospectionAnnotReqdJpa newDetachedEntity(String value) {
+        return new DomainObjectIntrospectionAnnotReqdJpa(value);
+    }
+
+}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/encapsulated/DomainObjectIntrospectionEncapsulated.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/encapsulated/DomainObjectIntrospectionEncapsulated.java
new file mode 100644
index 0000000000..050c290598
--- /dev/null
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/encapsulated/DomainObjectIntrospectionEncapsulated.java
@@ -0,0 +1,50 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package demoapp.dom.domain.objects.DomainObject.introspection.encapsulated;
+
+import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
+import demoapp.dom._infra.values.ValueHolder;
+
+import org.apache.causeway.applib.annotation.Editing;
+import org.apache.causeway.applib.annotation.Property;
+
+@SuppressWarnings("CdiManagedBeanInconsistencyInspection")
+public abstract class DomainObjectIntrospectionEncapsulated
+        implements
+        HasAsciiDocDescription,
+        ValueHolder<String> {
+
+    public String title() {
+        return value();
+    }
+
+    @Override
+    public String value() {
+        return getName();
+    }
+
+    public abstract String getName();
+    public abstract void setName(String value);
+
+    @Property(editing = Editing.DISABLED, editingDisabledReason = "This property cannot be edited")
+    public abstract String getOriginalName();
+    public abstract void setOriginalName(String value);
+
+    public abstract Character getInitialCharacter();
+}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/encapsulated/DomainObjectIntrospectionEncapsulatedSeeding.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/encapsulated/DomainObjectIntrospectionEncapsulatedSeeding.java
new file mode 100644
index 0000000000..7a9568d78b
--- /dev/null
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/encapsulated/DomainObjectIntrospectionEncapsulatedSeeding.java
@@ -0,0 +1,38 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package demoapp.dom.domain.objects.DomainObject.introspection.encapsulated;
+
+import demoapp.dom._infra.seed.SeedServiceAbstract;
+import demoapp.dom._infra.values.ValueHolderRepository;
+
+import javax.inject.Inject;
+
+import org.springframework.stereotype.Service;
+
+@Service
+public class DomainObjectIntrospectionEncapsulatedSeeding
+extends SeedServiceAbstract {
+
+    @Inject
+    public DomainObjectIntrospectionEncapsulatedSeeding(
+            ValueHolderRepository<String, ? extends DomainObjectIntrospectionEncapsulated> entities) {
+        super(entities);
+    }
+
+}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/encapsulated/jpa/DomainObjectIntrospectionEncapsulatedJpa-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/encapsulated/jpa/DomainObjectIntrospectionEncapsulatedJpa-description.adoc
new file mode 100644
index 0000000000..9a963d1904
--- /dev/null
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/encapsulated/jpa/DomainObjectIntrospectionEncapsulatedJpa-description.adoc
@@ -0,0 +1,10 @@
+:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or ag [...]
+
+In this demo app, property editing has been disabled by default, but has been explicitly enabled for this class:
+
+[source,java,indent=0]
+.DomainObjectIntrospectionEncapsulatedJpa.java
+----
+include::DomainObjectIntrospectionEncapsulatedJpa.java[tags=class]
+----
+<.> xxx
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/encapsulated/jpa/DomainObjectIntrospectionEncapsulatedJpa.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/encapsulated/jpa/DomainObjectIntrospectionEncapsulatedJpa.java
new file mode 100644
index 0000000000..f8d212e9a4
--- /dev/null
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/encapsulated/jpa/DomainObjectIntrospectionEncapsulatedJpa.java
@@ -0,0 +1,81 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package demoapp.dom.domain.objects.DomainObject.introspection.encapsulated.jpa;
+
+import demoapp.dom.domain.objects.DomainObject.editing.DomainObjectEditing;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
+import javax.inject.Named;
+import javax.persistence.*;
+
+import org.apache.causeway.applib.annotation.DomainObject;
+import org.apache.causeway.applib.annotation.Editing;
+import org.apache.causeway.applib.annotation.Introspection;
+import org.apache.causeway.applib.annotation.Property;
+import org.apache.causeway.persistence.jpa.applib.integration.CausewayEntityListener;
+import org.springframework.context.annotation.Profile;
+
+@Profile("demo-jpa")
+//tag::class[]
+@Entity
+@Table(
+    schema = "demo",
+    name = "DomainObjectIntrospectionJpa"
+)
+@EntityListeners(CausewayEntityListener.class)
+@Named("demo.DomainObjectIntrospection")
+@DomainObject(
+        introspection = Introspection.ANNOTATION_REQUIRED
+)
+@NoArgsConstructor
+public class DomainObjectIntrospectionEncapsulatedJpa extends DomainObjectEditing {
+    // ...
+//end::class[]
+
+    public DomainObjectIntrospectionEncapsulatedJpa(String value) {
+        setName(value);
+        setOriginalName(value);
+    }
+
+    @Id
+    @GeneratedValue
+    private Long id;
+//tag::class[]
+
+    @Getter @Setter
+    private String name;                        // <.>
+
+    @Property(
+            editing = Editing.DISABLED,         // <.>
+            editingDisabledReason = "This property may not be edited"
+    )
+    @Getter @Setter
+    private String originalName;
+
+    public Character getInitialCharacter() {    // <.>
+        return getName().charAt(0);
+    }
+//end::class[]
+
+
+//tag::class[]
+}
+//end::class[]
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/encapsulated/jpa/DomainObjectIntrospectionEncapsulatedJpaEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/encapsulated/jpa/DomainObjectIntrospectionEncapsulatedJpaEntities.java
new file mode 100644
index 0000000000..fe35787c9d
--- /dev/null
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/encapsulated/jpa/DomainObjectIntrospectionEncapsulatedJpaEntities.java
@@ -0,0 +1,40 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package demoapp.dom.domain.objects.DomainObject.introspection.encapsulated.jpa;
+
+import demoapp.dom._infra.values.ValueHolderRepository;
+
+import org.springframework.context.annotation.Profile;
+import org.springframework.stereotype.Service;
+
+@Profile("demo-jpa")
+@Service
+public class DomainObjectIntrospectionEncapsulatedJpaEntities
+extends ValueHolderRepository<String, DomainObjectIntrospectionEncapsulatedJpa> {
+
+    protected DomainObjectIntrospectionEncapsulatedJpaEntities() {
+        super(DomainObjectIntrospectionEncapsulatedJpa.class);
+    }
+
+    @Override
+    protected DomainObjectIntrospectionEncapsulatedJpa newDetachedEntity(String value) {
+        return new DomainObjectIntrospectionEncapsulatedJpa(value);
+    }
+
+}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/menubars.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/menubars.layout.xml
index f61f6fe148..7df2f14b51 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/menubars.layout.xml
+++ b/examples/demo/domain/src/main/java/demoapp/dom/menubars.layout.xml
@@ -31,6 +31,7 @@ For latest we use: https://raw.githubusercontent.com/apache/causeway/master/anto
                 <mb3:serviceAction objectType="demo.DomainObjectMenu" id="bounding"/>
                 <mb3:serviceAction objectType="demo.DomainObjectMenu" id="editing"/>
                 <mb3:serviceAction objectType="demo.DomainObjectMenu" id="entityChangePublishing"/>
+                <mb3:serviceAction objectType="demo.DomainObjectMenu" id="introspection"/>
                 <mb3:serviceAction objectType="demo.DomainObjectMenu" id="mixinMethod"/>
                 <mb3:serviceAction objectType="demo.DomainObjectMenu" id="natureStateful"/>
                 <mb3:serviceAction objectType="demo.DomainObjectMenu" id="natureStatefulRefsEntity"/>