Uploaded image for project: 'Cayenne'
  1. Cayenne
  2. CAY-1991

More control over generated String property names

    XMLWordPrintableJSON

Details

    • Task
    • Status: Closed
    • Major
    • Resolution: Done
    • 4.0.M2
    • 4.0.M3
    • None
    • None

    Description

      In 4.0 for each persistent property we are generating a pair of static values in the _ class. E.g.:

      @Deprecated
      public static final String TITLE_PROPERTY = "title";
      [..]
      public static final Property<String> TITLE = new Property<String>("title");

      Deprecated tag on String property was intended to show users that Property object should be used instead. This is good and explicit for migrating existing code to the new API, but there are few reasons why we might want to rethink this strategy:

      • brand new code would get all the deprecated stuff all the same
      • sometimes static String property names are actually needed. E.g. to use as custom annotation parameters. It is impossible to use Property objects for annotations, and using String constants generates compiler warning due to deprecation.

      I think the solution to that should be to stop adding @Deprecated annotation to String properties, but make String property names inclusion optional, controlled with "createPropertyNames" flag in cgen ("false" by default I guess - something to mention in UPGRADE.txt).

      Also a similar option should be available in CayenneModeler class generation dialog.

      Attachments

        Activity

          People

            SavvaKolbachev Savva Kolbachev
            andrus Andrus Adamchik
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: