public List<ObjectName> queries() {
            if (options.has(objectNameOpt)) {
                return options.valuesOf(objectNameOpt).stream()
                        .map(s -> {
                            try {
                                return new ObjectName(s);
                            } catch (MalformedObjectNameException e) {
                                throw new RuntimeException(e);
                            }
                        }).collect(Collectors.toList());
            } else {
                List<ObjectName> listWithNull = new ArrayList<>();
                listWithNull.add(null);
                return listWithNull;
            }
        }
A program for reading JMX metrics from a given endpoint.
<p>
This tool only works reliably if the JmxServer is fully initialized prior to invoking the tool.
See KAFKA-4620 for details.
tools/src/main/java/org/apache/kafka/tools/JmxTool.java