adding a new keyword 'property' to the java language

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Duplicate
    • Priority: P5
    • None
    • Affects Version/s: 5.0
    • Component/s: specification
    • x86
    • windows_xp

      A DESCRIPTION OF THE REQUEST :
      I feel that there is a need for a 'property' keyword in the java language.
      There is too many skeleton code that performs the same function over and over. example

      private String name;

      public String getName() {
      return name;
      }

      public void setName(String name) {
      this.name = name;
      }

      JUSTIFICATION :
      It would only be in the interest of the java language to have a 'property' keyword where one could specify the property name and let the compiler
      generate the getters and setters, and only if needed override the default
      behaviour.


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      public property String name;

      (the compiler would generate default getter and setter method stubs for the name attribute with public access, name would always be private, but could be combine with other access attributes) This would make the EJB3 POJO model also allot cleaner. When either a getter or setter does exist the compiler would use that instead.

      ---------- BEGIN SOURCE ----------
      private String name;

      public String getName() {
      return name;
      }

      public void setName(String name) {
      this.name = name;
      }

      [becomes]

      public property String name;

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Spending hours looking a getter and setter stub code.

            Assignee:
            Alex Buckley
            Reporter:
            Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: