Value Types

Built-in: JDK types

Apache Causeway can render and persist all the JDK primitives and wrapper classes, and a number of other JDK classes that represent value types.

It also supports a number of value types that are shipped by the framework itself.

In addition to primitives, the JDK Classes supported are:

  • the wrapper classes (in java.lang)

    Integer, Long, Short, Byte, Character, Float, Double, Boolean

  • strings and similar:

    • java.lang.String

    • any enum (subtype of java.lang.Enum)

  • numeric data types for arbitrary accuracy:

    • java.math.BigDecimal and java.math.BigInteger

      These can be combined with @Digits to specify scale.

Built-in: JDK Dates

Dates are also supported of course, though there are lots of options:

  • in the java.time package; these are the most modern and generally is to be preferred:

    • local times (no time zone):

      java.time.LocalDate, java.time.LocalTime, java.time.LocalDateTime

    • for storing date/time, with respect to the UTC:

      java.time.OffsetDateTime, java.time.OffsetTime

    • primarily for displaying time in a specified time zone:

      java.time.ZonedDateTime

  • in the java.util package (usage is discouraged since these classes are not immutable):

    java.util.Date

  • in the java.sql package:

    java.sql.Date, java.sql.Timestamp, java.sql.Time

Built-in: Other JDK types

  • miscellaneous:

    • java.net.URL

    • java.util.UUID

    • java.util.Locale

    • java.awt.BufferedImage

  • Full Calendar defines its own CalendarEvent value type.

Framework-defined

The framework also defines a number of custom value types:

  • Blob

  • Clob

  • Markup

    Rendered as HTML.

  • Password

    Holds a string whose value is suppressed in the UI.

    Note that this string is unencrypted.
  • LocalResourcePath

    Represents a local resource relative to the application’s context root (eg a servlet or controller).

    Actions that return results of this type result in a browser redirect to the resource. This is therefore a way to redirect to a custom controller.

  • TreePath and TreeNode

    These can be used to render tree structures.

In addition, there are a number of non-core value types that can be brought in individually:

  • AsciiDoc

    Rendered as HTML.

  • Markdown

    Rendered as HTML.

  • Vega

    Rendered as a dynamic graph. Content is a graph as described using the Vega-lite grammar.

More details of the above non-core value types can be found in the Value Types catalog.

The core framework also defines a number of value types whose use is primarily internal:

The Schema of XSDs define a number of DTOs (persisted by the above core extensions) which are also recognised as value types:

Custom value types

It is also possible to write your own value types, either scalar or composite. For more on this topic, see custom value types topic in the user guide.