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

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

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: core-1.2.0
    • Fix Version/s: core-1.4.0
    • Component/s: Core
    • Labels:
      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

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

              Dates

              • Created:
                Updated:
                Resolved: