View Javadoc
1   /*
2    * #%L
3    * HAPI FHIR - Core Library
4    * %%
5    * Copyright (C) 2014 - 2018 University Health Network
6    * %%
7    * Licensed under the Apache License, Version 2.0 (the "License");
8    * you may not use this file except in compliance with the License.
9    * You may obtain a copy of the License at
10   * 
11   *      http://www.apache.org/licenses/LICENSE-2.0
12   * 
13   * Unless required by applicable law or agreed to in writing, software
14   * distributed under the License is distributed on an "AS IS" BASIS,
15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   * See the License for the specific language governing permissions and
17   * limitations under the License.
18   * #L%
19   */
20  package ca.uhn.fhir.parser.json;
21  
22  import java.io.Reader;
23  import java.io.Writer;
24  
25  import ca.uhn.fhir.parser.DataFormatException;
26  
27  /**
28   * This interface is the generic representation of any sort of data 
29   * structure that looks and smells like JSON. These data structures
30   * can be abstractly viewed as a <code.Map</code> or <code>List</code>
31   * whose members are other Maps, Lists, or scalars (Strings, Numbers, Boolean)
32   * 
33   * @author Bill.Denton
34   */
35  public interface JsonLikeStructure {
36  	public JsonLikeStructure getInstance();
37  	
38  	/**
39  	 * Parse the JSON document into the Json-like structure
40  	 * so that it can be navigated.
41  	 * 
42  	 * @param theReader a <code>Reader</code> that will
43  	 * 			process the JSON input stream
44  	 * @throws DataFormatException when invalid JSON is received
45  	 */
46  	public void load (Reader theReader) throws DataFormatException;
47  	public void load (Reader theReader, boolean allowArray) throws DataFormatException;
48  	public JsonLikeObject getRootObject () throws DataFormatException;
49  	public JsonLikeArray getRootArray () throws DataFormatException;
50  	public JsonLikeWriter getJsonLikeWriter ();
51  	public JsonLikeWriter getJsonLikeWriter (Writer writer);
52  }