Debian Codegraph @

src/main/org/h2/util/json/JSONTarget.java

raw
1 /*
2 * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0,
3 * and the EPL 1.0 (https://h2database.com/html/license.html).
4 * Initial Developer: H2 Group
5 */
6 package org.h2.util.json;
7
8 import java.math.BigDecimal;
9
10 /**
11 * Abstract JSON output target.
12 *
13 * @param <R>
14 * the type of the result
15 */
16 public abstract class JSONTarget<R> {
17
18 /**
19 * Start of an object.
20 */
21 public abstract void startObject();
22
23 /**
24 * End of the current object.
25 */
26 public abstract void endObject();
27
28 /**
29 * Start of an array.
30 */
31 public abstract void startArray();
32
33 /**
34 * End of the current array.
35 */
36 public abstract void endArray();
37
38 /**
39 * Name of a member.
40 *
41 * @param name
42 * the name
43 */
44 public abstract void member(String name);
45
46 /**
47 * Parse "null".
48 *
49 * {@code null} value.
50 */
51 public abstract void valueNull();
52
53 /**
54 * Parse "false".
55 *
56 * {@code false} value.
57 */
58 public abstract void valueFalse();
59
60 /**
61 * Parse "true".
62 *
63 * {@code true} value.
64 */
65 public abstract void valueTrue();
66
67 /**
68 * A number value.
69 *
70 * @param number
71 * the number
72 */
73 public abstract void valueNumber(BigDecimal number);
74
75 /**
76 * A string value.
77 *
78 * @param string
79 * the string
80 */
81 public abstract void valueString(String string);
82
83 /**
84 * Returns whether member's name or the end of the current object is
85 * expected.
86 *
87 * @return {@code true} if it is, {@code false} otherwise
88 */
89 public abstract boolean isPropertyExpected();
90
91 /**
92 * Returns whether value separator expected before the next member or value.
93 *
94 * @return {@code true} if it is, {@code false} otherwise
95 */
96 public abstract boolean isValueSeparatorExpected();
97
98 /**
99 * Returns the result.
100 *
101 * @return the result
102 */
103 public abstract R getResult();
104
105 }