XStream
  1. XStream
  2. XSTR-722

ReflectionProvider.getFieldOrNull

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.4.4
    • Fix Version/s: 1.4.5
    • Component/s: Core
    • Labels:
      None

      Description

      In Jenkin's custom ReflectionConverter implementation, we'd like to read into transient fields (for backward compatibility when evolving classes) without writing transient fields.

      To do this, we check if the field is defined in a given class. To do this efficiently, we created {{ReflectionProvider.getFieldOrNull(Class definedIn, String fieldName)}.

      This method works like getField except that instead of throwing an exception (which is costly performance-wise), it returns null.

      Note that this method defers from the fieldDefinedInClass method in that it still finds fields that are marked transient.

      1. XSTR-722.diff
        2 kB
        Kohsuke Kawaguchi

        People

        • Assignee:
          Jörg Schaible
          Reporter:
          Kohsuke Kawaguchi
        • Votes:
          0 Vote for this issue
          Watchers:
          2 Start watching this issue

          Dates

          • Created:
            Updated:
            Resolved: