• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2010 The Android Open Source Project
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 
17 package com.android.json.stream;
18 
19 /**
20  * Lexical scoping elements within a JSON reader or writer.
21  */
22 enum JsonScope {
23 
24     /**
25      * An array with no elements requires no separators or newlines before
26      * it is closed.
27      */
28     EMPTY_ARRAY,
29 
30     /**
31      * A array with at least one value requires a comma and newline before
32      * the next element.
33      */
34     NONEMPTY_ARRAY,
35 
36     /**
37      * An object with no name/value pairs requires no separators or newlines
38      * before it is closed.
39      */
40     EMPTY_OBJECT,
41 
42     /**
43      * An object whose most recent element is a key. The next element must
44      * be a value.
45      */
46     DANGLING_NAME,
47 
48     /**
49      * An object with at least one name/value pair requires a comma and
50      * newline before the next element.
51      */
52     NONEMPTY_OBJECT,
53 
54     /**
55      * No object or array has been started.
56      */
57     EMPTY_DOCUMENT,
58 
59     /**
60      * A document with at an array or object.
61      */
62     NONEMPTY_DOCUMENT,
63 
64     /**
65      * A document that's been closed and cannot be accessed.
66      */
67     CLOSED,
68 }
69