MCPcopy Index your code
hub / github.com/jOOQ/jOOQ / JSONB

Class JSONB

jOOQ/src/main/java/org/jooq/JSONB.java:78–187  ·  view source on GitHub ↗

A JSON wrapper type for JSONB data obtained from the database. The wrapper represents JSONB #data() in serialised string form. A CAST(NULL AS JSONB) value is represented by a null reference of type JSONB, not as data() == null . This is consi

Source from the content-addressed store, hash-verified

76 * The {@link #data()} content, however, is not normalised.
77 */
78public final class JSONB implements Data {
79
80 private final String data;
81 private transient Object parsed;
82
83 private JSONB(String data) {
84 this.data = String.valueOf(data);
85 }
86
87 @Override
88 @NotNull
89 public final String data() {
90 return data;
91 }
92
93 /**
94 * Create a new {@link JSONB} instance from string data input.
95 */
96 @NotNull
97 public static final JSONB valueOf(String data) {
98 return new JSONB(data);
99 }
100
101 /**
102 * Create a new {@link JSONB} instance from string data input.
103 * <p>
104 * This is the same as {@link #valueOf(String)}, but it can be static
105 * imported.
106 */
107 @NotNull
108 public static final JSONB jsonb(String data) {
109 return new JSONB(data);
110 }
111
112 /**
113 * Create a new {@link JSONB} instance from string data input, or
114 * <code>null</code> if the input is <code>null</code>.
115 */
116 @Nullable
117 public static final JSONB jsonbOrNull(String data) {
118 return data == null ? null : jsonb(data);
119 }
120
121 private final Object parsed() {
122 if (parsed == null) {
123 try {
124 parsed = Internal.parseJSON(data);
125 }
126 catch (ParserException e) {
127 parsed = data;
128 }
129 }
130
131 return parsed;
132 }
133
134 // -------------------------------------------------------------------------
135 // The Object API

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…