public JmxProcess parseProcess ( File file ) throws IOException { String fileName = file . getName ( ) ; ObjectMapper mapper = fileName . endsWith ( ".yml" ) || fileName . endsWith ( ".yaml" ) ? yamlMapper : jsonMapper ; JsonNode jsonNode = mapper . readTree ( file ) ; JmxProcess jmx = mapper . treeToValue ( jsonNode , JmxProcess . class ) ; jmx . setName ( fileName ) ; return jmx ; }
Uses jackson to load json configuration from a File into a full object tree representation of that json .