Class MongoComplexUtilities


  • public final class MongoComplexUtilities
    extends Object
    This class contains utilities methods for dealing with MongoDB complex features.
    • Method Detail

      • resolvePath

        public static String resolvePath​(Feature feature,
                                         String jsonPath)
        Concat the parent path if it exists to the provided JSON path.
      • setParentPath

        public static void setParentPath​(Feature feature,
                                         String parentPath)
        Store the parent path in a feature user data map.
      • getValue

        public static Object getValue​(Object object,
                                      String jsonPath)
        Will try to extract from the provided object the value that correspond to the given json path.
      • extractFeature

        public static Feature extractFeature​(Feature feature,
                                             String jsonPath)
        Method for extracting or casting a feature from the provided object.
      • getValue

        public static Object getValue​(DBObject mongoObject,
                                      String jsonPath,
                                      Supplier<GeometryCoordinateSequenceTransformer> transformer)
        Will extract from the mongo db object the value that correspond to the given json path. If the path contain a nested list of values an exception will be throw.
      • getValue

        public static Object getValue​(DBObject mongoObject,
                                      Map<String,​Integer> collectionsIndexes,
                                      String jsonPath,
                                      Supplier<GeometryCoordinateSequenceTransformer> transformer)
        Will extract from the mongo db object the value that correspond to the given json path. The provided collections indexes will be used to select the proper element for the collections present in the path.
      • getValues

        public static Object getValues​(Object object,
                                       String jsonPath)
        Will try to extract from the provided object all the values that correspond to the given json path.
      • getValues

        public static Object getValues​(DBObject dbObject,
                                       String jsonPath,
                                       Supplier<GeometryCoordinateSequenceTransformer> transformer)
        Will extract from the mongo db object all the values that correspond to the given json path. If the path contains nested collections the values from all the branches will be merged.
      • findMappings

        public static Map<String,​Class> findMappings​(DBObject dbObject)
        Compute the mappings for a mongo db object, this can be used to create a feature mapping.
      • findMappings

        public static Map<String,​Class> findMappings​(DBCursor cursor)
        Compute the mappings for a mongodb cursor(iterator), this can be used to create a feature mapping. This method will close the cursor.