Class MapToProperties

java.lang.Object
dev.javatools.maputils.MapToProperties

public final class MapToProperties
extends java.lang.Object
Get the sorted list of all the properties (full json path and value) in a given Map
     Example:
          {
              "name": "James Butt",
              "age": 25,
              "dateOfBirth": "1995-05-15",
              "friends": [
                  {
                      "name": "Josephine Darakjy",
                      "age": 22,
                      "dateOfBirth": "1997-01-24",
                      "associatedAddresses": [
                          {
                              "street": "25 E 75th St #69",
                              "city": "Los Angeles",
                              "state": "CA",
                              "zip": "90034"
                          }
                      ]
                  }
              ],
              "primaryAddress": {
                  "street": "6649 N Blue Gum St",
                  "city": "New Orleans",
                  "state": "LA",
                  "zip": "70116"
              }
          }

      The above map will generate the below properties

          age=25
          dateOfBirth=1995-05-15
          friends[0].age=22
          friends[0].associatedAddresses[0].city=Los Angeles
          friends[0].associatedAddresses[0].state=CA
          friends[0].associatedAddresses[0].street=25 E 75th St #69
          friends[0].associatedAddresses[0].zip=90034
          friends[0].dateOfBirth=1997-01-24
          friends[0].name=Josephine Darakjy
          name=James Butt
          primaryAddress.city=New Orleans
          primaryAddress.state=LA
          primaryAddress.street=6649 N Blue Gum St
          primaryAddress.zip=70116
 
  • Method Summary

    Modifier and Type Method Description
    static java.util.Map getProperties​(java.util.Map source)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getProperties

      public static java.util.Map getProperties​(java.util.Map source)
      Parameters:
      source - Map to process and generate the list of all properties
      Returns:
      Sorted set of all the properties in the Map