class JsonReference {

  static JsonReference parse(String ref) {
    int urlEndIndex = ref.indexOf('#');

    if (urlEndIndex < 0) {
      throw new IllegalArgumentException("Invalid reference format: " + ref);
    }

    String url = urlEndIndex == 0 ? null : ref.substring(0, urlEndIndex);
    String pointerText = ref.substring(urlEndIndex + 1);
    JsonPointer pointer = JsonPointer.compile(pointerText);

    return new JsonReference(url, pointer);
  }

  public  JsonReference(JsonPointer pointer);
  public  JsonReference(String url, JsonPointer pointer);

}