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 7de0468e9ec8ac45a023df9ba9f0388fe889bedf
Author: danhaywood <[email protected]>
AuthorDate: Thu May 18 12:51:34 2023 +0100

    CAUSEWAY-2485 : updates to templates for value type demo gen
---
 .../demoshowcases/value/ValueShowCase.java         | 288 +++++++++++++--------
 .../demoshowcases/value/ValueTypeGenTemplate.java  | 138 ++++++----
 .../src/main/resources/$Templates-description.adoc |   4 +-
 3 files changed, 271 insertions(+), 159 deletions(-)

diff --git 
a/tooling/metaprog/src/main/java/org/apache/causeway/tooling/metaprog/demoshowcases/value/ValueShowCase.java
 
b/tooling/metaprog/src/main/java/org/apache/causeway/tooling/metaprog/demoshowcases/value/ValueShowCase.java
index dfd9a63d62..a198bfaca6 100644
--- 
a/tooling/metaprog/src/main/java/org/apache/causeway/tooling/metaprog/demoshowcases/value/ValueShowCase.java
+++ 
b/tooling/metaprog/src/main/java/org/apache/causeway/tooling/metaprog/demoshowcases/value/ValueShowCase.java
@@ -19,13 +19,11 @@
 package org.apache.causeway.tooling.metaprog.demoshowcases.value;
 
 import 
org.apache.causeway.tooling.metaprog.demoshowcases.value.ValueTypeGenTemplate.Config;
-import 
org.apache.causeway.tooling.metaprog.demoshowcases.value.ValueTypeGenTemplate.Config.ConfigBuilder;
 import 
org.apache.causeway.tooling.metaprog.demoshowcases.value.ValueTypeGenTemplate.Template;
 import 
org.apache.causeway.tooling.metaprog.demoshowcases.value.ValueTypeGenTemplate.TemplateVariant;
 
 import lombok.Getter;
 import lombok.RequiredArgsConstructor;
-import lombok.val;
 
 @RequiredArgsConstructor
 public enum ValueShowCase {
@@ -35,307 +33,387 @@ public enum ValueShowCase {
             .javaPackage("demoapp.dom.types.causeway.blobs")
             
.showcaseValueFullyQualifiedType("org.apache.causeway.applib.value.Blob")
             
.showcaseValueSemantics("org.apache.causeway.core.metamodel.valuesemantics.BlobValueSemantics")
-            .description("binary large objects")
+            .descriptionIfNoPreamble("binary large objects")
             .causewaySpecific(true)
-            .excludeJdoJpa(true)
-            .templateVariant(TemplateVariant.LOB)),
+            .templates(Template.NO_ORM_SET)
+            .templateVariant(TemplateVariant.LOB)
+    ),
     CLOB(Config.builder()
             .showcaseName("CausewayClob")
             .javaPackage("demoapp.dom.types.causeway.clobs")
             
.showcaseValueFullyQualifiedType("org.apache.causeway.applib.value.Clob")
             
.showcaseValueSemantics("org.apache.causeway.core.metamodel.valuesemantics.ClobValueSemantics")
-            .description("character large objects")
+            .descriptionIfNoPreamble("character large objects")
             .causewaySpecific(true)
-            .excludeJdoJpa(true)
-            .templateVariant(TemplateVariant.LOB)),
+            .templates(Template.NO_ORM_SET)
+            .templateVariant(TemplateVariant.LOB)
+    ),
     LOCALRESOURCEPATH(Config.builder()
             .showcaseName("CausewayLocalResourcePath")
             .javaPackage("demoapp.dom.types.causeway.localresourcepaths")
             
.showcaseValueFullyQualifiedType("org.apache.causeway.applib.value.LocalResourcePath")
             
.showcaseValueSemantics("org.apache.causeway.core.metamodel.valuesemantics.LocalResourcePathValueSemantics")
-            .templateVariant(TemplateVariant.DEFAULT)),
+            .preamble(
+                    "The framework has built-in support for representing 
servlets and other resources that exist alongside the Apache Causeway runtime, 
using the `LocalResourcePath` data type.\n" +
+                    "When an action returns an instance of this type, then 
this is rendered as a redirect request to the browser to that resource.\n" +
+                    "In this way you could for example return a link to a PDF 
or image (to be rendered by the web browser itself), or provide access to 
dynamic content by redirecting to a servlet.\n")
+            .causewaySpecific(true)
+            .templateVariant(TemplateVariant.DEFAULT)
+    ),
     PASSWORD(Config.builder()
             .showcaseName("CausewayPassword")
             .javaPackage("demoapp.dom.types.causeway.passwords")
             
.showcaseValueFullyQualifiedType("org.apache.causeway.applib.value.Password")
             
.showcaseValueSemantics("org.apache.causeway.core.metamodel.valuesemantics.PasswordValueSemantics")
-            .description("strings that are automatically masked as passwords")
+            .descriptionIfNoPreamble("strings that are automatically masked as 
passwords")
             .causewaySpecific(true)
-            .excludeJaxb(true)
-            .templateVariant(TemplateVariant.DEFAULT)),
-    TREENODE(Config.builder()
-            .showcaseName("CausewayTreeNode")
-            .javaPackage("demoapp.dom.types.causeway.treenode")
-            
.showcaseValueFullyQualifiedType("org.apache.causeway.applib.graph.tree.TreeNode")
-            
.showcaseValueSemantics("org.apache.causeway.core.metamodel.valuesemantics.TreeNodeValueSemantics")
-            .templateVariant(TemplateVariant.DEFAULT)),
+            .templates(Template.NO_VIEWMODEL_SET)
+            .templateVariant(TemplateVariant.DEFAULT)
+    ),
+//    TREENODE(Config.builder()
+//            .showcaseName("CausewayTreeNode")
+//            .javaPackage("demoapp.dom.types.causeway.treenode")
+//            
.showcaseValueFullyQualifiedType("org.apache.causeway.applib.graph.tree.TreeNode")
+//            
.showcaseValueSemantics("org.apache.causeway.core.metamodel.valuesemantics.TreeNodeValueSemantics")
+//            .descriptionIfNoPreamble("hierarchical tree nodes")
+//            .causewaySpecific(true)
+//            .templates(Template.REGULAR_SET_NO_SAMPLES)
+//            .templateVariant(TemplateVariant.DEFAULT)),
     CALENDAREVENT(Config.builder()
             .showcaseName("CausewayCalendarEvent")
             .javaPackage("demoapp.dom.types.causewayext.cal")
             
.showcaseValueFullyQualifiedType("org.apache.causeway.extensions.fullcalendar.applib.value.CalendarEvent")
             
.showcaseValueSemantics("org.apache.causeway.extensions.fullcalendar.applib.value.CalendarEventSemantics")
-            .templateVariant(TemplateVariant.DEFAULT)),
+            .preamble(
+                    "The framework has built-in support for modelling events 
on a calendar, using the `CalendarEvent` data type.\n" +
+                    "This is a editable composite type which is rendered as a 
HTML card.\n" +
+                    "It also integrates with the 
link:https://causeway.apache.org/vw/2.0.0-RC1/fullcalendar/about.html[FullCalendar]
 module; entities that implement the `CalendarEventable` interface (having a 
property of type `CalendarEvent`) will be rendered on a calendar.\n")
+            .causewaySpecific(true)
+            .templateVariant(TemplateVariant.DEFAULT)
+    ),
     JAVAAWTBUFFEREDIMAGE(Config.builder()
             .showcaseName("BufferedImage")
             .javaPackage("demoapp.dom.types.javaawt.images")
             .showcaseValueFullyQualifiedType("java.awt.image.BufferedImage")
             
.showcaseValueSemantics("org.apache.causeway.core.metamodel.valuesemantics.BufferedImageValueSemantics")
-            .templateVariant(TemplateVariant.DEFAULT)),
+            .frameworkSupportForJpa(true)
+            .frameworkSupportForJdo(true)
+            .frameworkSupportForJaxb(true)
+            .templateVariant(TemplateVariant.DEFAULT)
+    ),
     JAVAMATHBIGDECIMAL(Config.builder()
             .showcaseName("BigDecimal")
             .javaPackage("demoapp.dom.types.javamath.bigdecimals")
             .showcaseValueFullyQualifiedType("java.math.BigDecimal")
             
.showcaseValueSemantics("org.apache.causeway.core.metamodel.valuesemantics.BigDecimalValueSemantics")
-            .templateVariant(TemplateVariant.DEFAULT)),
+            .templateVariant(TemplateVariant.DEFAULT)
+    ),
     JAVAMATHBIGINTEGER(Config.builder()
             .showcaseName("BigInteger")
             .javaPackage("demoapp.dom.types.javamath.bigintegers")
             .showcaseValueFullyQualifiedType("java.math.BigInteger")
             
.showcaseValueSemantics("org.apache.causeway.core.metamodel.valuesemantics.BigIntegerValueSemantics")
-            .templateVariant(TemplateVariant.DEFAULT)),
+            .templateVariant(TemplateVariant.DEFAULT)
+    ),
     JAVANETURL(Config.builder()
             .showcaseName("URLs")
             .javaPackage("demoapp.dom.types.javanet.urls")
             .showcaseValueFullyQualifiedType("java.net.URL")
             
.showcaseValueSemantics("org.apache.causeway.core.metamodel.valuesemantics.URLValueSemantics")
-            .templateVariant(TemplateVariant.DEFAULT)),
+            .templateVariant(TemplateVariant.DEFAULT)
+    ),
     JAVASQLDATE(Config.builder()
             .showcaseName("JavaSqlDate")
             .javaPackage("demoapp.dom.types.javasql.javasqldate")
             .showcaseValueFullyQualifiedType("java.sql.Date")
             
.showcaseValueSemantics("org.apache.causeway.core.metamodel.valuesemantics.temporal.legacy.JavaSqlDateValueSemantics")
-            .templateVariant(TemplateVariant.DEFAULT)),
+            .preamble("The framework has built-in support for a number of 
temporal types, including `java.sql.Date`.\n")
+            .caveat("Rather than use this data type, consider using a more 
modern class such as `java.time.LocalDate`, `java.time.LocalDateTime` or 
`java.time.OffsetDateTime`")
+            .templateVariant(TemplateVariant.DEFAULT)
+    ),
     JAVASQLTIMESTAMP(Config.builder()
             .showcaseName("JavaSqlTimestamp")
             .javaPackage("demoapp.dom.types.javasql.javasqltimestamp")
             .showcaseValueFullyQualifiedType("java.sql.Timestamp")
             
.showcaseValueSemantics("org.apache.causeway.core.metamodel.valuesemantics.temporal.legacy.JavaSqlTimeStampValueSemantics")
-            .templateVariant(TemplateVariant.DEFAULT)),
+            .preamble("The framework has built-in support for a number of 
temporal types, including `java.sql.Timestamp`.")
+            .caveat("Rather than use this data type, consider using a more 
modern class such as `java.time.OffsetDateTime`")
+            .templateVariant(TemplateVariant.DEFAULT)
+    ),
     JAVATIMELOCALDATE(Config.builder()
             .showcaseName("LocalDate")
             .javaPackage("demoapp.dom.types.javatime.javatimelocaldate")
             .showcaseValueFullyQualifiedType("java.time.LocalDate")
             
.showcaseValueSemantics("org.apache.causeway.core.metamodel.valuesemantics.temporal.LocalDateValueSemantics")
-            .templateVariant(TemplateVariant.DEFAULT)),
+            .preamble("The framework has built-in support for a number of 
temporal types, including `java.time.LocalDate`.")
+            .templateVariant(TemplateVariant.DEFAULT)
+    ),
     JAVATIMELOCALDATETIME(Config.builder()
             .showcaseName("LocalDateTime")
             .javaPackage("demoapp.dom.types.javatime.javatimelocaldatetime")
             .showcaseValueFullyQualifiedType("java.time.LocalDateTime")
             
.showcaseValueSemantics("org.apache.causeway.core.metamodel.valuesemantics.temporal.LocalDateTimeValueSemantics")
-            .templateVariant(TemplateVariant.DEFAULT)),
+            .preamble("The framework has built-in support for a number of 
temporal types, including `java.time.LocalDateTime`.")
+            .templateVariant(TemplateVariant.DEFAULT)
+    ),
     JAVATIMELOCALTIME(Config.builder()
             .showcaseName("LocalTime")
             .javaPackage("demoapp.dom.types.javatime.javatimelocaltime")
             .showcaseValueFullyQualifiedType("java.time.LocalTime")
             
.showcaseValueSemantics("org.apache.causeway.core.metamodel.valuesemantics.temporal.LocalTimeValueSemantics")
-            .templateVariant(TemplateVariant.DEFAULT)),
+            .preamble("The framework has built-in support for a number of 
temporal types, including `java.time.LocalTime`.")
+            .templateVariant(TemplateVariant.DEFAULT)
+    ),
     JAVATIMEOFFSETDATETIME(Config.builder()
             .showcaseName("OffsetDateTime")
             .javaPackage("demoapp.dom.types.javatime.javatimeoffsetdatetime")
             .showcaseValueFullyQualifiedType("java.time.OffsetDateTime")
             
.showcaseValueSemantics("org.apache.causeway.core.metamodel.valuesemantics.temporal.OffsetDateTimeValueSemantics")
-            .templateVariant(TemplateVariant.DEFAULT)),
+            .preamble("The framework has built-in support for a number of 
temporal types, including `java.time.OffsetDateTime`.")
+            .templateVariant(TemplateVariant.DEFAULT)
+    ),
     JAVATIMEOFFSETTIME(Config.builder()
             .showcaseName("OffsetTime")
             .javaPackage("demoapp.dom.types.javatime.javatimeoffsetTime")
             .showcaseValueFullyQualifiedType("java.time.OffsetTime")
             
.showcaseValueSemantics("org.apache.causeway.core.metamodel.valuesemantics.temporal.OffsetTimeValueSemantics")
-            .templateVariant(TemplateVariant.DEFAULT)),
+            .preamble("The framework has built-in support for a number of 
temporal types, including `java.time.OffsetTime`.")
+            .templateVariant(TemplateVariant.DEFAULT)
+    ),
     JAVATIMEZONEDDATETIME(Config.builder()
             .showcaseName("ZonedDateTime")
             .javaPackage("demoapp.dom.types.javatime.javatimezoneddatetime")
             .showcaseValueFullyQualifiedType("java.time.ZonedDateTime")
             
.showcaseValueSemantics("org.apache.causeway.core.metamodel.valuesemantics.temporal.ZonedDateTimeValueSemantics")
-            .templateVariant(TemplateVariant.DEFAULT)),
+            .preamble("The framework has built-in support for a number of 
temporal types, including `java.time.ZonedDateTime`.")
+            .templateVariant(TemplateVariant.DEFAULT)
+    ),
     JAVAUTILDATE(Config.builder()
             .showcaseName("JavaUtilDate")
             .javaPackage("demoapp.dom.types.javautil.javautildate")
             .showcaseValueFullyQualifiedType("java.util.Date")
             
.showcaseValueSemantics("org.apache.causeway.core.metamodel.valuesemantics.temporal.legacy.JavaUtilDateValueSemantics")
-            .templateVariant(TemplateVariant.DEFAULT)),
+            .preamble("The framework has built-in support for a number of 
temporal types, including `java.util.Date`.")
+            .caveat("Rather than use this data type, consider using a more 
modern class such as `java.time.LocalDate`, `java.time.LocalDateTime` or 
`java.time.OffsetDateTime`.")
+            .frameworkSupportForJaxb(true)
+            .templateVariant(TemplateVariant.DEFAULT)
+    ),
     JODADATETIME(Config.builder()
             .showcaseName("JodaDateTime")
             .javaPackage("demoapp.dom.types.javatime.jodadatetime")
             .showcaseValueFullyQualifiedType("org.joda.time.DateTime")
             
.showcaseValueSemantics("org.apache.causeway.valuetypes.jodatime.integration.valuesemantics.JodaDateTimeValueSemantics")
-            .templateVariant(TemplateVariant.DEFAULT)),
+            .preamble("The framework has built-in support for a number of 
temporal types, including `org.joda.time.DateTime`.")
+            .caveat("Rather than use this data type, consider using a more 
modern class such as `java.time.OffsetDateTime`.")
+            .templateVariant(TemplateVariant.DEFAULT)
+    ),
     JODALOCALDATE(Config.builder()
             .showcaseName("JodaLocalDate")
             .javaPackage("demoapp.dom.types.javatime.jodalocaldate")
             .showcaseValueFullyQualifiedType("org.joda.time.LocalDate")
             
.showcaseValueSemantics("org.apache.causeway.valuetypes.jodatime.integration.valuesemantics.JodaLocalDateValueSemantics")
-            .templateVariant(TemplateVariant.DEFAULT)),
+            .preamble("The framework has built-in support for a number of 
temporal types, including `org.joda.time.LocalDate`")
+            .caveat("Rather than use this data type, consider using a more 
modern class such as `java.time.LocalDate`.")
+            .templateVariant(TemplateVariant.DEFAULT)
+    ),
     JODALOCALDATETIME(Config.builder()
             .showcaseName("JodaLocalDateTime")
             .javaPackage("demoapp.dom.types.javatime.jodalocaldatetime")
             .showcaseValueFullyQualifiedType("org.joda.time.LocalDateTime")
             
.showcaseValueSemantics("org.apache.causeway.valuetypes.jodatime.integration.valuesemantics.JodaLocalDateTimeValueSemantics")
-            .templateVariant(TemplateVariant.DEFAULT)),
+            .preamble("The framework has built-in support for a number of 
temporal types, including `org.joda.time.LocalDateTime`.")
+            .caveat("Rather than use this data type, consider using a more 
modern class such as `java.time.LocalDateTime`.")
+            .templateVariant(TemplateVariant.DEFAULT)
+    ),
     JODALOCALTIME(Config.builder()
             .showcaseName("JodaLocalTime")
             .javaPackage("demoapp.dom.types.javatime.jodalocaltime")
             .showcaseValueFullyQualifiedType("org.joda.time.LocalTime")
             
.showcaseValueSemantics("org.apache.causeway.valuetypes.jodatime.integration.valuesemantics.JodaLocalTimeValueSemantics")
-            .templateVariant(TemplateVariant.DEFAULT)),
-
+            .preamble("The framework has built-in support for a number of 
temporal types, including `org.joda.time.LocalTime`.")
+            .caveat("Rather than use this data type, consider using a more 
modern class such as `java.time.LocalTime`.")
+            .templateVariant(TemplateVariant.DEFAULT)
+    ),
     MARKUP(Config.builder()
             .showcaseName("CausewayMarkup")
             .javaPackage("demoapp.dom.types.causeway.markups")
             
.showcaseValueFullyQualifiedType("org.apache.causeway.applib.value.Markup")
             
.showcaseValueSemantics("org.apache.causeway.core.metamodel.valuesemantics.MarkupValueSemantics")
-            .templateVariant(TemplateVariant.LOB)),
+            .descriptionIfNoPreamble("arbitrary HTML markup")
+            .causewaySpecific(true)
+            .templateVariant(TemplateVariant.LOB)
+    ),
     MARKDOWN(Config.builder()
             .showcaseName("CausewayMarkdown")
             .javaPackage("demoapp.dom.types.causewayval.markdowns")
             
.showcaseValueFullyQualifiedType("org.apache.causeway.valuetypes.markdown.applib.value.Markdown")
             
.showcaseValueSemantics("org.apache.causeway.valuetypes.markdown.metamodel.semantics.MarkdownValueSemantics")
             .templates(Template.REGULAR_SET_NO_SAMPLES) // demo provides its 
own MarkdownSamples
-            .templateVariant(TemplateVariant.LOB)),
+            .descriptionIfNoPreamble("HTML markup, written in Markdown")
+            .causewaySpecific(true)
+            .templateVariant(TemplateVariant.LOB)
+    ),
     ASCIIDOC(Config.builder()
             .showcaseName("CausewayAsciiDoc")
             .javaPackage("demoapp.dom.types.causewayval.asciidocs")
             
.showcaseValueFullyQualifiedType("org.apache.causeway.valuetypes.asciidoc.applib.value.AsciiDoc")
             
.showcaseValueSemantics("org.apache.causeway.valuetypes.asciidoc.metamodel.semantics.AsciiDocValueSemantics")
             .templates(Template.REGULAR_SET_NO_SAMPLES) // demo provides its 
own AsciiDocSamples
-            .templateVariant(TemplateVariant.LOB)),
+            .descriptionIfNoPreamble("HTML markup, written in Asciidoc")
+            .causewaySpecific(true)
+            .templateVariant(TemplateVariant.LOB)
+    ),
     VEGA(Config.builder()
             .showcaseName("CausewayVega")
             .javaPackage("demoapp.dom.types.causewayval.vegas")
             
.showcaseValueFullyQualifiedType("org.apache.causeway.valuetypes.vega.applib.value.Vega")
             
.showcaseValueSemantics("org.apache.causeway.valuetypes.vega.metamodel.semantics.VegaValueSemantics")
-            .templateVariant(TemplateVariant.LOB)),
+            .descriptionIfNoPreamble("a visualization grammar (to render 
interactive graphs, maps and other designs)")
+            .causewaySpecific(true)
+            .templateVariant(TemplateVariant.LOB)
+    ),
     UUID(Config.builder()
             .showcaseName("JavaUtilUuid")
             .javaPackage("demoapp.dom.types.javautil.uuids")
             .showcaseValueFullyQualifiedType("java.util.UUID")
-            
.showcaseValueSemantics("org.apache.causeway.core.metamodel.valuesemantics.UUIDValueSemantics")),
+            
.showcaseValueSemantics("org.apache.causeway.core.metamodel.valuesemantics.UUIDValueSemantics")
+            .frameworkSupportForJpa(true)
+            .frameworkSupportForJdo(false)  // JDO supports out of the box
+    ),
     ENUM(Config.builder()
             .showcaseName("JavaLangEnum")
             .javaPackage("demoapp.dom.types.javalang.enums")
             
.showcaseValueFullyQualifiedType("demoapp.dom._infra.samples.DemoEnum")
             
.showcaseValueSemantics("org.apache.causeway.core.metamodel.valuesemantics.EnumValueSemantics")
-            .templates(Template.REGULAR_SET_NO_SAMPLES)), // demo provides its 
own EnumSamples
+            .templates(Template.REGULAR_SET_NO_SAMPLES) // demo provides its 
own EnumSamples
+    ),
     STRING(Config.builder()
             .showcaseName("JavaLangString")
             .javaPackage("demoapp.dom.types.javalang.strings")
             .showcaseValueFullyQualifiedType("java.lang.String")
             
.showcaseValueSemantics("org.apache.causeway.core.metamodel.valuesemantics.StringValueSemantics")
-            .templates(Template.REGULAR_SET_NO_SAMPLES)), // demo provides its 
own NameSamples
+            .templates(Template.REGULAR_SET_NO_SAMPLES) // demo provides its 
own NameSamples
+    ),
 //    VOID(Config.builder()
 //            .showcaseName("JavaLangVoid")
 //            .javaPackage("demoapp.dom.types.javalang.voids")
 //            .showcaseValueType("java.lang.Void")
 //            
.showcaseValueSemantics("org.apache.causeway.core.metamodel.valuesemantics.VoidValueSemantics")),
 
-    PBOOL(fundamentalTypeSupportNotice()
+    PBOOL(Config.builder()
             .showcaseName("PrimitiveBoolean")
             .javaPackage("demoapp.dom.types.primitive.booleans")
             .showcaseValueFullyQualifiedType("boolean")
             
.showcaseValueSemantics("org.apache.causeway.core.metamodel.valuesemantics.BooleanValueSemantics")
             .templates(Template.PRIMITIVE_SET)
-            .templateVariant(TemplateVariant.PRIMITIVE)),
-    PCHAR(fundamentalTypeSupportNotice()
+            .templateVariant(TemplateVariant.PRIMITIVE)
+    ),
+    PCHAR(Config.builder()
             .showcaseName("PrimitiveChar")
             .javaPackage("demoapp.dom.types.primitive.chars")
             .showcaseValueFullyQualifiedType("char")
             
.showcaseValueSemantics("org.apache.causeway.core.metamodel.valuesemantics.CharacterValueSemantics")
             .templates(Template.PRIMITIVE_SET)
-            .templateVariant(TemplateVariant.PRIMITIVE)),
-    PLONG(fundamentalTypeSupportNotice()
+            .templateVariant(TemplateVariant.PRIMITIVE)
+    ),
+    PLONG(Config.builder()
             .showcaseName("PrimitiveLong")
             .javaPackage("demoapp.dom.types.primitive.longs")
             .showcaseValueFullyQualifiedType("long")
             
.showcaseValueSemantics("org.apache.causeway.core.metamodel.valuesemantics.LongValueSemantics")
             .templates(Template.PRIMITIVE_SET)
-            .templateVariant(TemplateVariant.PRIMITIVE)),
-    PINT(fundamentalTypeSupportNotice()
+            .templateVariant(TemplateVariant.PRIMITIVE)
+    ),
+    PINT(Config.builder()
             .showcaseName("PrimitiveInt")
             .javaPackage("demoapp.dom.types.primitive.ints")
             .showcaseValueFullyQualifiedType("int")
             
.showcaseValueSemantics("org.apache.causeway.core.metamodel.valuesemantics.IntValueSemantics")
             .templates(Template.PRIMITIVE_SET)
-            .templateVariant(TemplateVariant.PRIMITIVE)),
-    PSHORT(fundamentalTypeSupportNotice()
+            .templateVariant(TemplateVariant.PRIMITIVE)
+    ),
+    PSHORT(Config.builder()
             .showcaseName("PrimitiveShort")
             .javaPackage("demoapp.dom.types.primitive.shorts")
             .showcaseValueFullyQualifiedType("short")
             
.showcaseValueSemantics("org.apache.causeway.core.metamodel.valuesemantics.ShortValueSemantics")
             .templates(Template.PRIMITIVE_SET)
-            .templateVariant(TemplateVariant.PRIMITIVE)),
-    PBYTE(fundamentalTypeSupportNotice()
+            .templateVariant(TemplateVariant.PRIMITIVE)
+    ),
+    PBYTE(Config.builder()
             .showcaseName("PrimitiveByte")
             .javaPackage("demoapp.dom.types.primitive.bytes")
             .showcaseValueFullyQualifiedType("byte")
             
.showcaseValueSemantics("org.apache.causeway.core.metamodel.valuesemantics.ByteValueSemantics")
             .templates(Template.PRIMITIVE_SET)
-            .templateVariant(TemplateVariant.PRIMITIVE)),
-    PDOUBLE(fundamentalTypeSupportNotice()
+            .templateVariant(TemplateVariant.PRIMITIVE)
+    ),
+    PDOUBLE(Config.builder()
             .showcaseName("PrimitiveDouble")
             .javaPackage("demoapp.dom.types.primitive.doubles")
             .showcaseValueFullyQualifiedType("double")
             
.showcaseValueSemantics("org.apache.causeway.core.metamodel.valuesemantics.DoubleValueSemantics")
             .templates(Template.PRIMITIVE_SET)
-            .templateVariant(TemplateVariant.PRIMITIVE)),
-    PFLOAT(fundamentalTypeSupportNotice()
+            .templateVariant(TemplateVariant.PRIMITIVE)
+    ),
+    PFLOAT(Config.builder()
             .showcaseName("PrimitiveFloat")
             .javaPackage("demoapp.dom.types.primitive.floats")
             .showcaseValueFullyQualifiedType("float")
             
.showcaseValueSemantics("org.apache.causeway.core.metamodel.valuesemantics.FloatValueSemantics")
             .templates(Template.PRIMITIVE_SET)
-            .templateVariant(TemplateVariant.PRIMITIVE)),
-    WBOOL(fundamentalTypeSupportNotice()
+            .templateVariant(TemplateVariant.PRIMITIVE)
+    ),
+    WBOOL(Config.builder()
             .showcaseName("WrapperBoolean")
             .javaPackage("demoapp.dom.types.javalang.booleans")
             .showcaseValueFullyQualifiedType("java.lang.Boolean")
-            
.showcaseValueSemantics("org.apache.causeway.core.metamodel.valuesemantics.BooleanValueSemantics")),
-    WCHAR(fundamentalTypeSupportNotice()
+            
.showcaseValueSemantics("org.apache.causeway.core.metamodel.valuesemantics.BooleanValueSemantics")
+    ),
+    WCHAR(Config.builder()
             .showcaseName("WrapperCharacter")
             .javaPackage("demoapp.dom.types.javalang.characters")
             .showcaseValueFullyQualifiedType("java.lang.Character")
-            
.showcaseValueSemantics("org.apache.causeway.core.metamodel.valuesemantics.CharacterValueSemantics")),
-    WLONG(fundamentalTypeSupportNotice()
-                .showcaseName("WrapperLong")
-                .javaPackage("demoapp.dom.types.javalang.longs")
-                .showcaseValueFullyQualifiedType("java.lang.Long")
-                
.showcaseValueSemantics("org.apache.causeway.core.metamodel.valuesemantics.LongValueSemantics")),
-    WINT(fundamentalTypeSupportNotice()
-                .showcaseName("WrapperInteger")
-                .javaPackage("demoapp.dom.types.javalang.integers")
-                .showcaseValueFullyQualifiedType("java.lang.Integer")
-                
.showcaseValueSemantics("org.apache.causeway.core.metamodel.valuesemantics.IntValueSemantics")),
-    WSHORT(fundamentalTypeSupportNotice()
-                .showcaseName("WrapperShort")
-                .javaPackage("demoapp.dom.types.javalang.shorts")
-                .showcaseValueFullyQualifiedType("java.lang.Short")
-                
.showcaseValueSemantics("org.apache.causeway.core.metamodel.valuesemantics.ShortValueSemantics")),
-    WBYTE(fundamentalTypeSupportNotice()
-                .showcaseName("WrapperByte")
-                .javaPackage("demoapp.dom.types.javalang.bytes")
-                .showcaseValueFullyQualifiedType("java.lang.Byte")
-                
.showcaseValueSemantics("org.apache.causeway.core.metamodel.valuesemantics.ByteValueSemantics")),
-    WDOUBLE(fundamentalTypeSupportNotice()
-                .showcaseName("WrapperDouble")
-                .javaPackage("demoapp.dom.types.javalang.doubles")
-                .showcaseValueFullyQualifiedType("java.lang.Double")
-                
.showcaseValueSemantics("org.apache.causeway.core.metamodel.valuesemantics.DoubleValueSemantics")),
-    WFLOAT(fundamentalTypeSupportNotice()
-                .showcaseName("WrapperFloat")
-                .javaPackage("demoapp.dom.types.javalang.floats")
-                .showcaseValueFullyQualifiedType("java.lang.Float")
-                
.showcaseValueSemantics("org.apache.causeway.core.metamodel.valuesemantics.FloatValueSemantics")),
+            
.showcaseValueSemantics("org.apache.causeway.core.metamodel.valuesemantics.CharacterValueSemantics")
+    ),
+    WLONG(Config.builder()
+            .showcaseName("WrapperLong")
+            .javaPackage("demoapp.dom.types.javalang.longs")
+            .showcaseValueFullyQualifiedType("java.lang.Long")
+            
.showcaseValueSemantics("org.apache.causeway.core.metamodel.valuesemantics.LongValueSemantics")
+    ),
+    WINT(Config.builder()
+            .showcaseName("WrapperInteger")
+            .javaPackage("demoapp.dom.types.javalang.integers")
+            .showcaseValueFullyQualifiedType("java.lang.Integer")
+            
.showcaseValueSemantics("org.apache.causeway.core.metamodel.valuesemantics.IntValueSemantics")
+    ),
+    WSHORT(Config.builder()
+            .showcaseName("WrapperShort")
+            .javaPackage("demoapp.dom.types.javalang.shorts")
+            .showcaseValueFullyQualifiedType("java.lang.Short")
+            
.showcaseValueSemantics("org.apache.causeway.core.metamodel.valuesemantics.ShortValueSemantics")
+    ),
+    WBYTE(Config.builder()
+            .showcaseName("WrapperByte")
+            .javaPackage("demoapp.dom.types.javalang.bytes")
+            .showcaseValueFullyQualifiedType("java.lang.Byte")
+            
.showcaseValueSemantics("org.apache.causeway.core.metamodel.valuesemantics.ByteValueSemantics")
+    ),
+    WDOUBLE(Config.builder()
+            .showcaseName("WrapperDouble")
+            .javaPackage("demoapp.dom.types.javalang.doubles")
+            .showcaseValueFullyQualifiedType("java.lang.Double")
+            
.showcaseValueSemantics("org.apache.causeway.core.metamodel.valuesemantics.DoubleValueSemantics")
+    ),
+    WFLOAT(Config.builder()
+            .showcaseName("WrapperFloat")
+            .javaPackage("demoapp.dom.types.javalang.floats")
+            .showcaseValueFullyQualifiedType("java.lang.Float")
+            
.showcaseValueSemantics("org.apache.causeway.core.metamodel.valuesemantics.FloatValueSemantics")
+    ),
     ;
 
     @Getter final ValueTypeGenTemplate.Config.ConfigBuilder configBuilder;
 
-    private static ConfigBuilder fundamentalTypeSupportNotice() {
-        val defaults = Config.builder().build();
-        return Config.builder()
-                .jdoTypeSupportNotice(defaults.getJdoTypeSupportNotice()
-                        + " see 
link:https://www.datanucleus.org/products/accessplatform_6_0/jdo/mapping.html#_primitive_and_java_lang_types[DataNucleus]";)
-                .jpaTypeSupportNotice(defaults.getJpaTypeSupportNotice()
-                        + " see 
link:https://www.objectdb.com/java/jpa/entity/types#simple_java_data_types[ObjectDB]";)
-                .jaxbTypeSupportNotice(defaults.getJaxbTypeSupportNotice()
-                        + " see 
link:https://docs.oracle.com/cd/E12840_01/wls/docs103/webserv/data_types.html#wp223908[Oracle]";);
-    }
-
 }
diff --git 
a/tooling/metaprog/src/main/java/org/apache/causeway/tooling/metaprog/demoshowcases/value/ValueTypeGenTemplate.java
 
b/tooling/metaprog/src/main/java/org/apache/causeway/tooling/metaprog/demoshowcases/value/ValueTypeGenTemplate.java
index 035add04f2..e2ad87d441 100644
--- 
a/tooling/metaprog/src/main/java/org/apache/causeway/tooling/metaprog/demoshowcases/value/ValueTypeGenTemplate.java
+++ 
b/tooling/metaprog/src/main/java/org/apache/causeway/tooling/metaprog/demoshowcases/value/ValueTypeGenTemplate.java
@@ -50,56 +50,87 @@ public class ValueTypeGenTemplate {
     public static class Config {
         final File outputRootDir;
         final String showcaseName;
+
+        final String showcaseValueFullyQualifiedType;
+        final String showcaseValueSemantics;
+
+        public String getShowcaseValueSimpleType() {
+            String fqt = getShowcaseValueFullyQualifiedType();
+            int i = fqt.lastIndexOf(".");
+            String simpleType = fqt.substring(i + 1);
+            return simpleType;
+        }
+
         /**
-         * If set, then the template files in the `jdo` and `jpa` packages are 
NOT generated.
-         * This is to accommodate data types such as Blob and Clob that need 
custom treatment.
+         * If present, is used instead the first sentence.
          */
-        final boolean excludeJdoJpa;
+        final String preamble;
+
         /**
-         * If set, then the template files in the `jaxb` package is NOT 
generated.
-         * This is to accommodate data types such as Password that need custom 
treatment.
+         * If present, is used after the first sentence.
          */
-        final boolean excludeJaxb;
+        final String caveat;
+
+        public String getPreamble() {
+            return preamble != null
+                    ? preamble
+                    : "The framework has built-in support for " +
+                    (getDescriptionIfNoPreamble() != null
+                        ? getDescriptionIfNoPreamble() + ", using"
+                        : "") +
+                    " the `" + getShowcaseValueSimpleType() + "` data type.";
+        }
+
+
         /**
-         * If present, is used within the first sentence.
+         * If present, is used within the first sentence (unless preamble 
specified, in which case that overrides
          */
-        final String description;
+        final String descriptionIfNoPreamble;
         /**
          * If present, adds a NOTE: ...  and also changes what {@link 
#getJdoTypeSupportNotice()}, {@link #getJpaTypeSupportNotice()} and {@link 
#getJaxbTypeSupportNotice()} returns.
          */
         final boolean causewaySpecific;
-        final String showcaseValueFullyQualifiedType;
-        final String showcaseValueSemantics;
-        @Builder.Default
-        final String jdoTypeSupportNotice =
-            "JDO supports `#{showcase-simple-type}` out-of-the-box, so no 
special annotations are required.";
 
-        public String getJdoTypeSupportNotice() {
-            return causewaySpecific
-                        ? "Apache Causeway provides its own implementation of 
the relevant JDO extension points for the `" + getShowcaseValueSimpleType() + 
"` value type, meaning that JDO can persist properties of this value type 
without further configuration."
-                        : jdoTypeSupportNotice;
+        final boolean frameworkSupportForJpa;
+        /**
+         * Implied by {@link #isCausewaySpecific()}, if present then indicates 
that the framework has added support for JPA persistence for certain data types.
+         */
+        private boolean isFrameworkSupportForJpa() {
+            return causewaySpecific || frameworkSupportForJpa;
         }
-
-        @Builder.Default
-        final String jpaTypeSupportNotice =
-            "JPA supports `#{showcase-simple-type}` out-of-the-box, so no 
special annotations are required.";
-
         public String getJpaTypeSupportNotice() {
-            return causewaySpecific
+            return isFrameworkSupportForJpa()
                         ? "Apache Causeway provides its own implementation of 
the relevant JPA extension points for the `" + getShowcaseValueSimpleType() + 
"` value type, meaning that JPA can persist properties of this value type 
without further configuration."
-                        : jpaTypeSupportNotice;
+                        : "JPA supports `" + getShowcaseValueSimpleType() + "` 
out-of-the-box, so no special annotations are required.\nSee 
link:https://www.objectdb.com/java/jpa/entity/types#simple_java_data_types[ObjectDB]";;
         }
 
-        @Builder.Default
-        final String jaxbTypeSupportNotice =
-            "JAXB supports `#{showcase-simple-type}` out-of-the-box, so no 
special annotations are required.";
+        final boolean frameworkSupportForJdo;
+        /**
+         * Implied by {@link #isCausewaySpecific()}, if present then indicates 
that the framework has added support for JDO persistence for certain data types.
+         */
+        private boolean isFrameworkSupportForJdo() {
+            return causewaySpecific || frameworkSupportForJdo;
+        }
+        public String getJdoTypeSupportNotice() {
+            return isFrameworkSupportForJdo()
+                        ? "Apache Causeway provides its own implementation of 
the relevant JDO extension points for the `" + getShowcaseValueSimpleType() + 
"` value type, meaning that JDO can persist properties of this value type 
without further configuration."
+                        : "JDO supports `" + getShowcaseValueSimpleType() + "` 
out-of-the-box, so no special annotations are required.\nSee 
link:https://www.datanucleus.org/products/accessplatform_6_0/jdo/mapping.html#_primitive_and_java_lang_types[DataNucleus]";;
+        }
 
+        final boolean frameworkSupportForJaxb;
+        /**
+         * Implied by {@link #isCausewaySpecific()}, if present then indicates 
that the framework has added support for JAXB serialization for certain data 
types.
+         */
+        private boolean isFrameworkSupportForJaxb() {
+            return causewaySpecific || frameworkSupportForJaxb;
+        }
         public String getJaxbTypeSupportNotice() {
-            return causewaySpecific
+            return isFrameworkSupportForJaxb()
                     ? "Apache Causeway provides its own implementation of 
`@XmlJavaTypeAdapter` for the `" + getShowcaseValueSimpleType() + "` value 
type, meaning that JAXB can serialize properties of this value type without 
further configuration."
-                    : jaxbTypeSupportNotice;
+                    : "JAXB supports `" + getShowcaseValueSimpleType() + "` 
out-of-the-box, so no special annotations are required.\nSee 
link:https://docs.oracle.com/cd/E12840_01/wls/docs103/webserv/data_types.html#wp223908[Oracle]";;
         }
 
+
         final String javaPackage;
         @Builder.Default
         final String fileNamePlaceholderForShowcaseName = "$Template";
@@ -112,12 +143,6 @@ public class ValueTypeGenTemplate {
         @Builder.Default
         final TemplateVariant templateVariant = TemplateVariant.DEFAULT;
 
-        public String getShowcaseValueSimpleType() {
-            String fqt = getShowcaseValueFullyQualifiedType();
-            int i = fqt.lastIndexOf(".");
-            String simpleType = fqt.substring(i + 1);
-            return simpleType;
-        }
     }
 
     @RequiredArgsConstructor
@@ -169,30 +194,47 @@ public class ValueTypeGenTemplate {
         
HOLDER_UPDATE_ROO_PROPERTY("holder/%sHolder_updateReadOnlyOptionalProperty", 
Generator.JAVA),
         
HOLDER_UPDATE_RO_PROPERTY_WITH_CHOICES("holder/%sHolder_updateReadOnlyPropertyWithChoices",
 Generator.JAVA),
         
HOLDER_UPDATE_ROO_PROPERTY_WITH_CHOICES("holder/%sHolder_updateReadOnlyOptionalPropertyWithChoices",
 Generator.JAVA),
-        COLLECTION("%ss", Generator.JAVA),
+
         JDO("jdo/%sJdo", Generator.JAVA),
         JDO_ENTITIES("jdo/%sJdoEntities", Generator.JAVA),
+        JDO_DESCRIPTION("jdo/%sJdo-description", Generator.DOC),
+
         JPA("jpa/%sJpa", Generator.JAVA),
         JPA_ENTITIES("jpa/%sJpaEntities", Generator.JAVA),
+        JPA_DESCRIPTION("jpa/%sJpa-description", Generator.DOC),
+
         ENTITY("persistence/%sEntity", Generator.JAVA),
+        ENTITY_LAYOUT("persistence/%sEntity", Generator.LAYOUT),
         SEEDING("persistence/%sSeeding", Generator.JAVA),
+
         SAMPLES("samples/%sSamples", Generator.JAVA),
+
         VIEWMODEL("vm/%sVm", Generator.JAVA),
+        VIEWMODEL_DESCRIPTION("vm/%sVm-description", Generator.DOC),
+        VIEWMODEL_LAYOUT("vm/%sVm", Generator.LAYOUT),
 
+        COLLECTION("%ss", Generator.JAVA),
         COMMON_DOC("%ss-common", Generator.DOC),
         DESCRIPTION("%ss-description", Generator.DOC),
-        JDO_DESCRIPTION("jdo/%sJdo-description", Generator.DOC),
-        JPA_DESCRIPTION("jpa/%sJpa-description", Generator.DOC),
-        VIEWMODEL_DESCRIPTION("vm/%sVm-description", Generator.DOC),
-
         COLLECTION_LAYOUT("%ss", Generator.LAYOUT),
-        ENTITY_LAYOUT("persistence/%sEntity", Generator.LAYOUT),
-        VIEWMODEL_LAYOUT("vm/%sVm", Generator.LAYOUT)
         ;
 
         public static Can<Template> REGULAR_SET = 
Can.ofArray(Template.values())
             .remove(HOLDER_ACTION_RETURNING_ARRAY);
 
+        public static Can<Template> NO_ORM_SET = REGULAR_SET
+                .remove(JPA)
+                .remove(JPA_DESCRIPTION)
+                .remove(JPA_ENTITIES)
+                .remove(JDO)
+                .remove(JDO_DESCRIPTION)
+                .remove(JDO_ENTITIES);
+
+        public static Can<Template> NO_VIEWMODEL_SET = REGULAR_SET
+                .remove(VIEWMODEL)
+                .remove(VIEWMODEL_DESCRIPTION)
+                .remove(VIEWMODEL_LAYOUT);
+
         public static Can<Template> REGULAR_SET_NO_SAMPLES = 
Can.ofArray(Template.values())
                 .remove(HOLDER_ACTION_RETURNING_ARRAY)
                 .remove(SAMPLES);
@@ -261,15 +303,6 @@ public class ValueTypeGenTemplate {
         for(var template: config.getTemplates()) {
 
             val templateFile = template.templateFile(config);
-            String templateFilePath = templateFile.getCanonicalPath();
-            if (config.isExcludeJdoJpa() &&
-               (templateFilePath.contains("jdo") || 
templateFilePath.contains("jpa"))) {
-                continue;
-            }
-            if (config.isExcludeJaxb() &&
-                templateFilePath.contains("jaxb")) {
-                continue;
-            }
 
             val genTarget = template.outputFile(config);
 
@@ -277,7 +310,8 @@ public class ValueTypeGenTemplate {
             templateVars.putAll(config.templateVariables);
             templateVars.put("java-package", template.javaPackage(config));
             templateVars.put("showcase-name", config.showcaseName);
-            templateVars.put("showcase-description", (config.getDescription() 
!= null ? config.getDescription() + ", using" : ""));
+            templateVars.put("showcase-preamble", config.getPreamble());
+            templateVars.put("showcase-caveat", (config.getCaveat() != null ? 
config.getCaveat() + "\n\n" : ""));
             templateVars.put("showcase-note-if-causeway-specific", 
(config.isCausewaySpecific() ? "NOTE: This is an Apache Causeway specific data 
type.\n\n": ""));
             templateVars.put("showcase-simple-type", 
config.getShowcaseValueSimpleType());
             templateVars.put("showcase-fully-qualified-type", 
config.showcaseValueFullyQualifiedType);
diff --git a/tooling/metaprog/src/main/resources/$Templates-description.adoc 
b/tooling/metaprog/src/main/resources/$Templates-description.adoc
index 756564d374..d252bb7eda 100644
--- a/tooling/metaprog/src/main/resources/$Templates-description.adoc
+++ b/tooling/metaprog/src/main/resources/$Templates-description.adoc
@@ -1,9 +1,9 @@
 :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 [...]
 
-The framework has built-in support for #{showcase-description} the 
`#{showcase-simple-type}` data type.
+#{showcase-preamble}
 These can be used either in entities or view models.
 
-#{showcase-note-if-causeway-specific}== How this demo works
+#{showcase-caveat}#{showcase-note-if-causeway-specific}== How this demo works
 
 On the left hand side is a collection of entities that uses the 
`#{showcase-simple-type}` datatype.
 There is also an action that opens a view model; this view model also uses the 
`#{showcase-simple-type}` datatype.


Reply via email to