Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6500698

adding a new keyword 'property' to the java language

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P5 P5
    • None
    • 5.0
    • 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.

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: