| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| JSONString |
|
| 1.0;1 |
| 1 | /* | |
| 2 | * Copyright 2002-2009 the original author or authors. | |
| 3 | * | |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 5 | * you may not use this file except in compliance with the License. | |
| 6 | * You may obtain a copy of the License at | |
| 7 | * | |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
| 9 | * | |
| 10 | * Unless required by applicable law or agreed to in writing, software | |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 13 | * See the License for the specific language governing permissions and | |
| 14 | * limitations under the License. | |
| 15 | */ | |
| 16 | package net.sf.json; | |
| 17 | ||
| 18 | /** | |
| 19 | * The <code>JSONString</code> interface allows a <code>toJSONString()</code> | |
| 20 | * method so that a class can change the behavior of | |
| 21 | * <code>JSONObject.toString()</code>, <code>JSONArray.toString()</code>, | |
| 22 | * and <code>JSONWriter.value(</code>Object<code>)</code>. The | |
| 23 | * <code>toJSONString</code> method will be used instead of the default | |
| 24 | * behavior of using the Object's <code>toString()</code> method and quoting | |
| 25 | * the result. | |
| 26 | */ | |
| 27 | public interface JSONString { | |
| 28 | /** | |
| 29 | * The <code>toJSONString</code> method allows a class to produce its own | |
| 30 | * JSON serialization. | |
| 31 | * | |
| 32 | * @return A strictly syntactically correct JSON text. | |
| 33 | */ | |
| 34 | public String toJSONString(); | |
| 35 | } |