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

Put Listeners On Any Class Attribute

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 5.0
    • specification
    • x86
    • windows_xp

      Name: js151677 Date: 09/13/2004


      A DESCRIPTION OF THE REQUEST :
      It would be great to have a language enhancement in Java, which allows attaching listeners to ordinary attributes (and to methods) of any class instance. With that mechanism it would be much simpler to build MVC models.

      JUSTIFICATION :
      This would make Java better than C#

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The runtime performance of a normal attribute change (or method call) should not change, unless at least one listener is attached to it.

      Object a = new MyClass();

      a.addAttributeListener("attributeName", new AttributeListener() {
       public void valueChange(AttributeChangeEvent ev) {
         Object ov = ev.oldValue()
         Object nv = ev.newValue();
       }
      }
      )

      a.addMethodListener("methodName", paramClassArray, new MethodListener()....);
      (Incident Review ID: 310509)
      ======================================================================

            abuckley Alex Buckley
            jssunw Jitender S (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: