Class XContentMapValues


  • public class XContentMapValues
    extends Object
    • Constructor Detail

      • XContentMapValues

        public XContentMapValues()
    • Method Detail

      • extractRawValues

        public static List<Object> extractRawValues​(String path,
                                                    Map<String,​Object> map)
        Extracts raw values (string, int, and so on) based on the path provided returning all of them as a single list.
      • extractValue

        public static Object extractValue​(String path,
                                          Map<?,​?> map)
      • extractValue

        public static Object extractValue​(Map<?,​?> map,
                                          String... pathElements)
      • filter

        public static Map<String,​Object> filter​(Map<String,​?> map,
                                                      String[] includes,
                                                      String[] excludes)
        Only keep properties in map that match the includes but not the excludes. An empty list of includes is interpreted as a wildcard while an empty list of excludes does not match anything. If a property matches both an include and an exclude, then the exclude wins. If an object matches, then any of its sub properties are automatically considered as matching as well, both for includes and excludes. Dots in field names are treated as sub objects. So for instance if a document contains a.b as a property and a is an include, then a.b will be kept in the filtered map.
      • isObject

        public static boolean isObject​(Object node)
      • isArray

        public static boolean isArray​(Object node)
      • nodeStringValue

        public static String nodeStringValue​(Object node,
                                             String defaultValue)
      • nodeFloatValue

        public static float nodeFloatValue​(Object node,
                                           float defaultValue)
      • nodeFloatValue

        public static float nodeFloatValue​(Object node)
      • nodeDoubleValue

        public static double nodeDoubleValue​(Object node,
                                             double defaultValue)
      • nodeDoubleValue

        public static double nodeDoubleValue​(Object node)
      • nodeIntegerValue

        public static int nodeIntegerValue​(Object node)
      • nodeIntegerValue

        public static int nodeIntegerValue​(Object node,
                                           int defaultValue)
      • nodeShortValue

        public static short nodeShortValue​(Object node,
                                           short defaultValue)
      • nodeShortValue

        public static short nodeShortValue​(Object node)
      • nodeByteValue

        public static byte nodeByteValue​(Object node,
                                         byte defaultValue)
      • nodeByteValue

        public static byte nodeByteValue​(Object node)
      • nodeLongValue

        public static long nodeLongValue​(Object node,
                                         long defaultValue)
      • nodeLongValue

        public static long nodeLongValue​(Object node)
      • nodeBooleanValue

        public static boolean nodeBooleanValue​(Object node,
                                               String name,
                                               boolean defaultValue)
      • nodeBooleanValue

        public static boolean nodeBooleanValue​(Object node,
                                               boolean defaultValue)
      • nodeBooleanValue

        public static boolean nodeBooleanValue​(Object node,
                                               String name)
      • nodeBooleanValue

        public static boolean nodeBooleanValue​(Object node)
      • nodeStringArrayValue

        public static String[] nodeStringArrayValue​(Object node)
        Returns an array of string value from a node value. If the node represents an array the corresponding array of strings is returned. Otherwise the node is treated as a comma-separated string.