Uploaded image for project: 'Causeway'
  1. Causeway
  2. CAUSEWAY-543

title() should take precedence over @Title, or perhaps should fail eagerly?

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • core-1.2.0
    • core-1.4.0
    • Core
    • None

    Description

      from discussion on mailing list:

      Every domain object should provide a title - a string representation of itself that is sufficiently unique to identify it to the end-user. There are two main ways of doing this, either declaratively - using @Title annotations - or imperatively - with the title() method. (If neither are present, then toString() is used).

      This ticket is so that the declarative behaviour is the default, but if a class provides a title() method, then this should be used instead. The ticket also suggested that perhaps having both @Title and title() might be considered an error, in which case we could use the MetaModelValidator interface to prevent Isis from booting. However, I think this doesn't make sense, because it might be that the properties annotated with @Title might be inherited from a superclass, whereas the subclass might want to override this with its own title(). So having both shouldn't be considered an error.

      I suspect that the fix is very easy ... just reversing the order of the registration of TitleAnnotationFacetFactory and TitleMethodFacetFactory in ProgrammingModelFacetsJava5.

      Attachments

        1. ISIS-543.patch
          5 kB
          Othmen Tiliouine

        Activity

          People

            danhaywood Daniel Keir Haywood
            danhaywood Daniel Keir Haywood
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: