Clover icon

Coverage Report

  1. Project Clover database Wed Nov 13 2024 16:21:17 GMT
  2. Package jalview.javascript.json

File JSON.java

 

Coverage histogram

../../../img/srcFileCovDistChart0.png
59% of files have more coverage

Code metrics

0
4
5
1
91
31
5
1.25
0.8
5
1

Classes

Class Line # Actions
JSON 42 4 5
0.00%
 

Contributing tests

No tests hitting this source file were found.

Source view

1    /*
2    * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3    * Copyright (C) $$Year-Rel$$ The Jalview Authors
4    *
5    * This file is part of Jalview.
6    *
7    * Jalview is free software: you can redistribute it and/or
8    * modify it under the terms of the GNU General Public License
9    * as published by the Free Software Foundation, either version 3
10    * of the License, or (at your option) any later version.
11    *
12    * Jalview is distributed in the hope that it will be useful, but
13    * WITHOUT ANY WARRANTY; without even the implied warranty
14    * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15    * PURPOSE. See the GNU General Public License for more details.
16    *
17    * You should have received a copy of the GNU General Public License
18    * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19    * The Jalview Authors are detailed in the 'AUTHORS' file.
20    */
21    package jalview.javascript.json;
22   
23    import java.io.BufferedReader;
24    import java.io.InputStream;
25    import java.net.URL;
26   
27    /**
28    *
29    * A rudimentary JSON converter/iterator that uses the browser's native AJAX
30    * json data type delivery mechanism.
31    *
32    * Arrays are delivered as ArrayList<Object> where Object may be Boolean,
33    * String, Long, Double, ArrayList, and "Map-like object".
34    *
35    * For speed, the maps returned are just JavaScript maps with a few added
36    * methods for extracting data. [get(), contains(), probably should add keySet,
37    * valueSet, and entrySet].
38    *
39    * @author hansonr Bob Hanson St. Olaf College 1/24/2019
40    *
41    */
 
42    public class JSON
43    {
44   
45    /**
46    * A simple encoding of sequential key/value pairs for a jQuery.ajax call. If
47    * the first key is "url" and the second is an object, then the ajax object is
48    * attached to that url as well, just for transport purposes within the
49    * system.
50    *
51    * @param keyValues
52    * assumed to be simple String,Object pairs. String objects will be
53    * surrounded by double quotes.
54    */
 
55  0 toggle @SuppressWarnings("static-access")
56    public static Object setAjax(Object... keyValues)
57    {
58  0 return /** @j2sNative swingjs.JSUtil.setAjax$OA(keyValues) || */
59    null;
60    }
61   
 
62  0 toggle public static void setAjax(URL url)
63    {
64    /** @j2sNative swingjs.JSUtil.setAjax$java_net_URL(url); */
65    }
66   
 
67  0 toggle public static BufferedReader getJSONReader(InputStream is)
68    {
69  0 return /** @j2sNative swingjs.JSUtil.getJSONReader$O(is) || */
70    null;
71    }
72   
73    /**
74    *
75    * @param obj
76    * as String, Reader, InputStream, or JavaScript Object or Array
77    * @return Map or List
78    */
 
79  0 toggle public static Object parse(Object obj)
80    {
81  0 return /** @j2sNative swingjs.JSUtil.parseJSON$O(obj) || */
82    null;
83    }
84   
 
85  0 toggle public static String stringify(Object obj)
86    {
87  0 return /** @j2sNative swingjs.JSUtil.stringifyJSON$O(obj) || */
88    null;
89    }
90   
91    }