@@ -52,8 +52,7 @@ public class JsonPointer
52
52
* Constructor used for creating "empty" instance, used to represent
53
53
* state that matches current node.
54
54
*/
55
- protected JsonPointer ()
56
- {
55
+ protected JsonPointer () {
57
56
_nextSegment = null ;
58
57
_matchingPropertyName = "" ;
59
58
_matchingElementIndex = -1 ;
@@ -63,8 +62,7 @@ protected JsonPointer()
63
62
/**
64
63
* Constructor used for creating non-empty Segments
65
64
*/
66
- protected JsonPointer (String fullString , String segment , JsonPointer next )
67
- {
65
+ protected JsonPointer (String fullString , String segment , JsonPointer next ) {
68
66
_asString = fullString ;
69
67
_nextSegment = next ;
70
68
// Ok; may always be a property
@@ -87,17 +85,15 @@ protected JsonPointer(String fullString, String segment, JsonPointer next)
87
85
* expression: currently the only such expression is one that does NOT start with
88
86
* a slash ('/').
89
87
*/
90
- public static JsonPointer compile (String input )
91
- throws IllegalArgumentException
88
+ public static JsonPointer compile (String input ) throws IllegalArgumentException
92
89
{
93
90
// First quick checks for well-known 'empty' pointer
94
91
if ((input == null ) || input .length () == 0 ) {
95
92
return EMPTY ;
96
93
}
97
94
// And then quick validity check:
98
95
if (input .charAt (0 ) != '/' ) {
99
- throw new IllegalArgumentException ("Invalid input: JSON Pointer expression must start with '/': "
100
- +"\" " +input +"\" " );
96
+ throw new IllegalArgumentException ("Invalid input: JSON Pointer expression must start with '/': " +"\" " +input +"\" " );
101
97
}
102
98
return _parseTail (input );
103
99
}
@@ -108,10 +104,7 @@ public static JsonPointer compile(String input)
108
104
*/
109
105
public static JsonPointer valueOf (String input ) { return compile (input ); }
110
106
111
- /*
112
-
113
- /**
114
- * Factory method that composes a pointer instance, given a set
107
+ /* Factory method that composes a pointer instance, given a set
115
108
* of 'raw' segments: raw meaning that no processing will be done,
116
109
* no escaping may is present.
117
110
*
@@ -139,25 +132,11 @@ public static JsonPointer fromSegment(String... segments)
139
132
/**********************************************************
140
133
*/
141
134
142
- public boolean matches () {
143
- return _nextSegment == null ;
144
- }
145
-
146
- public String getMatchingProperty () {
147
- return _matchingPropertyName ;
148
- }
149
-
150
- public int getMatchingIndex () {
151
- return _matchingElementIndex ;
152
- }
153
-
154
- public boolean mayMatchProperty () {
155
- return _matchingPropertyName != null ;
156
- }
157
-
158
- public boolean mayMatchElement () {
159
- return _matchingElementIndex >= 0 ;
160
- }
135
+ public boolean matches () { return _nextSegment == null ; }
136
+ public String getMatchingProperty () { return _matchingPropertyName ; }
137
+ public int getMatchingIndex () { return _matchingElementIndex ; }
138
+ public boolean mayMatchProperty () { return _matchingPropertyName != null ; }
139
+ public boolean mayMatchElement () { return _matchingElementIndex >= 0 ; }
161
140
162
141
public JsonPointer matchProperty (String name ) {
163
142
if (_nextSegment == null || !_matchingPropertyName .equals (name )) {
@@ -187,24 +166,13 @@ public JsonPointer tail() {
187
166
/**********************************************************
188
167
*/
189
168
190
- @ Override
191
- public String toString () {
192
- return _asString ;
193
- }
194
-
195
- @ Override
196
- public int hashCode () {
197
- return _asString .hashCode ();
198
- }
169
+ @ Override public String toString () { return _asString ; }
170
+ @ Override public int hashCode () { return _asString .hashCode (); }
199
171
200
- @ Override
201
- public boolean equals (Object o )
202
- {
172
+ @ Override public boolean equals (Object o ) {
203
173
if (o == this ) return true ;
204
174
if (o == null ) return false ;
205
- if (!(o instanceof JsonPointer )) {
206
- return false ;
207
- }
175
+ if (!(o instanceof JsonPointer )) return false ;
208
176
return _asString .equals (((JsonPointer ) o )._asString );
209
177
}
210
178
@@ -214,8 +182,7 @@ public boolean equals(Object o)
214
182
/**********************************************************
215
183
*/
216
184
217
- private final static int _parseInt (String str )
218
- {
185
+ private final static int _parseInt (String str ) {
219
186
final int len = str .length ();
220
187
if (len == 0 ) {
221
188
return -1 ;
@@ -230,8 +197,7 @@ private final static int _parseInt(String str)
230
197
return NumberInput .parseInt (str );
231
198
}
232
199
233
- protected static JsonPointer _parseTail (String input )
234
- {
200
+ protected static JsonPointer _parseTail (String input ) {
235
201
final int end = input .length ();
236
202
237
203
// first char is the contextual slash, skip
@@ -259,8 +225,7 @@ protected static JsonPointer _parseTail(String input)
259
225
* @param input Full input for the tail being parsed
260
226
* @param i Offset to character after tilde
261
227
*/
262
- protected static JsonPointer _parseQuotedTail (String input , int i )
263
- {
228
+ protected static JsonPointer _parseQuotedTail (String input , int i ) {
264
229
final int end = input .length ();
265
230
StringBuilder sb = new StringBuilder (Math .max (16 , end ));
266
231
if (i > 2 ) {
@@ -284,8 +249,7 @@ protected static JsonPointer _parseQuotedTail(String input, int i)
284
249
return new JsonPointer (input , sb .toString (), EMPTY );
285
250
}
286
251
287
- private static void _appendEscape (StringBuilder sb , char c )
288
- {
252
+ private static void _appendEscape (StringBuilder sb , char c ) {
289
253
if (c == '0' ) {
290
254
c = '~' ;
291
255
} else if (c == '1' ) {
0 commit comments