Class MapToPaths

java.lang.Object
dev.javatools.maputils.MapToPaths

public final class MapToPaths
extends java.lang.Object
Get the sorted list of all the paths (full json path) 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
          dateOfBirth
          friends[0].age
          friends[0].associatedAddresses[0].city
          friends[0].associatedAddresses[0].state
          friends[0].associatedAddresses[0].street
          friends[0].associatedAddresses[0].zip
          friends[0].dateOfBirth
          friends[0].name
          name
          primaryAddress.city
          primaryAddress.state
          primaryAddress.street
          primaryAddress.zip
 
  • Method Summary

    Modifier and Type Method Description
    static java.util.Set<java.lang.String> getPaths​(java.util.Map input)  
    static java.util.Set<java.lang.String> getUniquePaths​(java.util.Map input)  

    Methods inherited from class java.lang.Object

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

    • getPaths

      public static java.util.Set<java.lang.String> getPaths​(java.util.Map input)
      Parameters:
      input - Map to process
      Returns:
      Sorted set of all the paths in the Map In this the paths repeat with the position number if the objects are within the list/set/array. To get unique paths, use getUniquePaths.
    • getUniquePaths

      public static java.util.Set<java.lang.String> getUniquePaths​(java.util.Map input)
      Parameters:
      input - Map to process
      Returns:
      Sorted set of all the unique paths in the map. What is Unique? Paths related to the objects that are in the list/set/array of items are considered same.