Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-602

ValueMap#get(java.lang.String name, T defaultValue) should support Integer

    XMLWordPrintableJSON

Details

    • Wish
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • JCR Resource 2.0.4
    • JCR Resource 2.0.4
    • JCR
    • None
    • Windows XP, Sling Version 2.0.3-incubator-SNAPSHOT (running of Communiqué5)

    Description

      Hi,

      Working with the sling API, I've been using the ValueMap class rather frequently:
      org.apache.sling.api.resource.ValueMap

      I noticed that the type java.util.Lang is supported for the getter methods, but the type java.util.Integer is apparently not supported.
      The getter methods i am referring to:
      <T> T get(java.lang.String name, java.lang.Class<T> type)
      <T> T get(java.lang.String name, T defaultValue)

      Personally I would find it very convenient to be able to pass integers as default values and also get an integer as return type.
      Apart from the convenience aspect, the lack of Integer support is really a source for bugs: It's intuitive to pass Integers - it will compile fine but not work in the end.

      Attachments

        Activity

          People

            fmeschbe Felix Meschberger
            vogla Andreas Vogl
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: