Uploaded image for project: 'Isis'
  1. Isis
  2. ISIS-1695

Support value types (simple ones at least) as a first-class citizen

    XMLWordPrintableJSON

    Details

    • Type: New Feature
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Isis Incubator
    • Labels:
      None

      Description

      I would like to reintroduce value types as a first-class citizen, but without requiring the developer to have to write lots of code to teach DataNucleus, Wicket and the RO viewer about these.

      I don't have a general solution in mind on how to do this.

      However, for very simple value types that are just a type-safe wrapper around a single field (eg Password, or Money, or Temperature, or Email say), then perhaps there might be a way to support this, eg :

      public class Temperature implements org.apache.isis.valuetypes.Value<BigDecimal>

      {     public Temperature(BigDecimal value) \{ ... }

          BigDecimal getValue() { ... }

      }

      or

      @Value(underlying=BigDecimal.class)
      public class Temperature { ... }

      The idea here is that the framework would treat any instance of this custom value type as if it were the underlying type (BigDecimal in the case above). It would also be possible to apply validations to the value type that would apply everywhere it is used as a property/parameter.

       

      We would expect these value types to be immutable, and (although this can't be expressed in an interface), would expect there to be a public 1-arg constructor of the appropriate type, and a package-local "getValue()" method.  These allow the framework to marshal values in and out of the value type.

       

       

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                danhaywood Daniel Keir Haywood
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated: