code: public static RestartPolicy parse(String serialized) throws IllegalArgumentException {
          try {
              String[] parts = serialized.split(":");
              String name = parts[0];
              if ("no".equals(name)) {
                  return noRestart();
              }
  
              if ("always".equals(name)) {
                  return alwaysRestart();
              }
  
              if ("unless-stopped".equals(name)) {
                  return unlessStoppedRestart();
              }
  
              if ("on-failure".equals(name)) {
                  int count = 0;
                  if (parts.length == 2) {
                      count = Integer.parseInt(parts[1]);
                  }
                  return onFailureRestart(count);
              }
              throw new IllegalArgumentException();
          } catch (Exception e) {
              throw new IllegalArgumentException("Error parsing RestartPolicy '" + serialized + "'");
          }
      }
docs: Parses a textual restart polixy specification (as used by the Docker CLI) to a {@link RestartPolicy}.
  
  @param serialized
  the specification, e.g. <code>on-failure:2</code>
  @return a {@link RestartPolicy} matching the specification
  @throws IllegalArgumentException
  if the specification cannot be parsed