private static Object modelMapper(Map<String, Object> data) throws IOException {
    String kind = (String) data.get("kind");
    if (kind == null) {
      throw new IOException("Missing kind in YAML file!");
    }
    String apiVersion = (String) data.get("apiVersion");
    if (apiVersion == null) {
      throw new IOException("Missing apiVersion in YAML file!");
    }

    Class<?> clazz = (Class<?>) classes.get(apiVersion + "/" + kind);
    if (clazz == null) {
      // Attempt to detect class from version and kind alone
      if (apiVersion.contains("/")) {
        clazz = (Class<?>) classes.get(apiVersion.split("/")[1] + "/" + kind);
      }
    }
    if (clazz == null) {
      throw new IOException(
          "Unknown apiVersionKind: "
              + apiVersion
              + "/"
              + kind
              + " known kinds are: "
              + classes.toString());
    }
    return loadAs(new StringReader(getSnakeYaml().dump(data)), clazz);
  }
private static Object modelMapper ( Map < String , Object > data ) throws IOException { String kind = ( String ) data . get ( "kind" ) ; if ( kind == null ) { throw new IOException ( "Missing kind in YAML file!" ) ; } String apiVersion = ( String ) data . get ( "apiVersion" ) ; if ( apiVersion == null ) { throw new IOException ( "Missing apiVersion in YAML file!" ) ; } Class < ? > clazz = ( Class < ? > ) classes . get ( apiVersion + "/" + kind ) ; if ( clazz == null ) { if ( apiVersion . contains ( "/" ) ) { clazz = ( Class < ? > ) classes . get ( apiVersion . split ( "/" ) [ 1 ] + "/" + kind ) ; } } if ( clazz == null ) { throw new IOException ( "Unknown apiVersionKind: " + apiVersion + "/" + kind + " known kinds are: " + classes . toString ( ) ) ; } return loadAs ( new StringReader ( getSnakeYaml ( ) . dump ( data ) ) , clazz ) ; }
@param data Map that will be converted to concrete API object.
@return An instantiation of the object.
@throws IOException