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

JFR: getField(String) should be able to access subfields

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P3 P3
    • 16
    • 16
    • hotspot
    • jfr
    • b28

      The method RecordedEvent:getField(String) allows a user to get a field for an event type, for example eventType.getField("monitorClass").

      The value of an event can be obtained by invoking event.getValue("monitorClass"), but it's also possible to index into a nested value by using ".", for example getValue("monitorClass.modifiers"). The latter can't be done when using getField(String). It is inconsistent and inconvenient as it to forces users to traverse the fields manually:

      for (ValueDescriptor v : eventType.getField("monitorClass").getFields()) {
          if ("modifiers".equals(v.getName()) {
            return v;
          }
      }

      instead of doing getField("monitorClass.modifiers")

            egahlin Erik Gahlin
            egahlin Erik Gahlin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: