Skip to content

Commit d65bdd7

Browse files
committed
feat!: Remove the SPI and create the org.jsonurl.j2se package
BREAKING CHANGE The service provider interface didn't provide any real world value so it's been removed. A new org.jsonurl.j2se package has been created. The JavaValueFactory and JavaValueParser classes have been moved into it, and JavaValueParser has been renamed to JsonUrlParser in order to be consistent with the naming convention used in org.jsonurl.jsonorg and org.jsonurl.jsr374.
1 parent 6093388 commit d65bdd7

File tree

16 files changed

+42
-128
lines changed

16 files changed

+42
-128
lines changed

module/jsonurl-core/src/main/java/org/jsonurl/JsonUrl.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package org.jsonurl;
22

33
/*
4-
* Copyright 2019 David MacCormack
4+
* Copyright 2019-2020 David MacCormack
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
77
* use this file except in compliance with the License. You may obtain a copy
@@ -32,6 +32,7 @@
3232

3333
import java.io.IOException;
3434
import java.nio.charset.MalformedInputException;
35+
import org.jsonurl.j2se.JavaValueFactory;
3536

3637
/**
3738
* This class provides static methods for performing a number of
@@ -621,6 +622,7 @@ public static final <V> V parseLiteral(
621622
* {@link #parseLiteral(CharSequence, int, int, ValueFactory)
622623
* parseLiteral(s, start, length, JavaValueFactory.PRIMITIVE)}.
623624
* @see JsonUrl#parseLiteral(CharSequence, int, int, ValueFactory)
625+
* @see JavaValueFactory#PRIMITIVE
624626
*/
625627
public static final Object parseLiteral(
626628
CharSequence s,

module/jsonurl-core/src/main/java/org/jsonurl/Parser.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
* with specific types and an instance of
4848
* {@link org.jsonurl.ValueFactory ValueFactory}. If you don't need
4949
* control over types you may use
50-
* {@link org.jsonurl.JavaValueParser JavaValueParser}.
50+
* {@link org.jsonurl.j2se.JsonUrlParser JsonUrlParser}.
5151
*
5252
* @param V value type (any JSON value)
5353
* @param C composite type (array or object)

module/jsonurl-core/src/main/java/org/jsonurl/JavaValueFactory.java renamed to module/jsonurl-core/src/main/java/org/jsonurl/j2se/JavaValueFactory.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package org.jsonurl;
1+
package org.jsonurl.j2se;
22

33
/*
44
* Copyright 2019 David MacCormack
@@ -23,6 +23,10 @@
2323
import java.util.List;
2424
import java.util.Map;
2525
import java.util.Set;
26+
import org.jsonurl.NumberBuilder;
27+
import org.jsonurl.NumberText;
28+
import org.jsonurl.ValueFactory;
29+
import org.jsonurl.ValueType;
2630

2731
/**
2832
* A {@link org.jsonurl.ValueFactory ValueFactory} based on Java SE data types.

module/jsonurl-core/src/main/java/org/jsonurl/JavaValueParser.java renamed to module/jsonurl-core/src/main/java/org/jsonurl/j2se/JsonUrlParser.java

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
package org.jsonurl;
1+
package org.jsonurl.j2se;
22

33
/*
4-
* Copyright 2019 David MacCormack
4+
* Copyright 2019-2020 David MacCormack
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
77
* use this file except in compliance with the License. You may obtain a copy
@@ -19,6 +19,7 @@
1919

2020
import java.util.List;
2121
import java.util.Map;
22+
import org.jsonurl.Parser;
2223

2324
/**
2425
* A {@link org.jsonurl.Parser Parser} based on Java SE data types.
@@ -27,7 +28,7 @@
2728
* @author David MacCormack
2829
* @since 2019-09-01
2930
*/
30-
public class JavaValueParser extends Parser.TransparentBuilder<Object,
31+
public class JsonUrlParser extends Parser.TransparentBuilder<Object,
3132
Object,
3233
List<Object>,
3334
Map<String,Object>,
@@ -39,14 +40,14 @@ public class JavaValueParser extends Parser.TransparentBuilder<Object,
3940
/**
4041
* Instantiate a new Parser.
4142
*/
42-
public JavaValueParser() {
43+
public JsonUrlParser() {
4344
this(JavaValueFactory.PRIMITIVE);
4445
}
4546

4647
/**
4748
* Instantiate a new Parser.
4849
*/
49-
public JavaValueParser(JavaValueFactory factory) {
50+
public JsonUrlParser(JavaValueFactory factory) {
5051
super(factory);
5152
}
5253
}

module/jsonurl-core/src/main/java/org/jsonurl/spi/package-info.java renamed to module/jsonurl-core/src/main/java/org/jsonurl/j2se/package-info.java

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
/**
2-
* The JSON&#x2192;URL service provider interface.
2+
* This package provides an implementation of the JSON&#x2192;URL parser
3+
* based on Java SE datatypes.
4+
*
5+
* <p>The primary entry point for most use cases
6+
* {@link org.jsonurl.j2se.JsonUrlParser JsonUrlParser}, which implements a
7+
* JSON object model API to parse JSON&#x2192;URL text using Java SE types (e.g.
8+
* {@link java.util.Map Map}, {@link java.util.List List}, etc).
39
*
410
* @author jsonurl.org
511
* @author David MacCormack
612
* @since 2019-09-01
713
*/
8-
package org.jsonurl.spi;
14+
package org.jsonurl.j2se;
915

1016
/*
1117
* Copyright 2019 David MacCormack

module/jsonurl-core/src/main/java/org/jsonurl/package-info.java

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
/**
22
* This package provides an extensible JSON&#x2192;URL parser core and
3-
* an implementation based on Java SE datatypes.
3+
* static utility methods.
44
*
5-
* <p>The primary entry point for most use cases
6-
* {@link org.jsonurl.JavaValueParser JavaValueParser}, which implements a
7-
* JSON object model API to parse JSON&#x2192;URL text using Java SE types (e.g.
8-
* {@link java.util.Map Map}, {@link java.util.List List}, etc).
9-
*
105
* <p>If you need a parser bound to your own JSON model API then
116
* a {@link org.jsonurl.ValueFactory ValueFactory} may be created and
12-
* supplied to an instance of {@link org.jsonurl.Parser Parser}.
7+
* supplied to an instance of {@link org.jsonurl.Parser Parser}. Otherwise,
8+
* if a parser based on J2SE datatypes is sufficient then
9+
* take a look at {@link org.jsonurl.j2se.JsonUrlParser JsonUrlParser} which
10+
* does just that.
1311
*
1412
* @author jsonurl.org
1513
* @author David MacCormack

module/jsonurl-core/src/main/java/org/jsonurl/spi/JsonUrlServiceProvider.java

-34
This file was deleted.

module/jsonurl-core/src/test/java/org/jsonurl/BigMathParseTest.java

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package org.jsonurl;
22

3+
import org.jsonurl.j2se.JavaValueFactory;
4+
35
/*
46
* Copyright 2019 David MacCormack
57
*

module/jsonurl-core/src/test/java/org/jsonurl/DoubleParseTest.java

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package org.jsonurl;
22

3+
import org.jsonurl.j2se.JavaValueFactory;
4+
35
/*
46
* Copyright 2019 David MacCormack
57
*

module/jsonurl-core/src/test/java/org/jsonurl/JavaValueFactoryParseTest.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package org.jsonurl;
22

33
/*
4-
* Copyright 2019 David MacCormack
4+
* Copyright 2019-2020 David MacCormack
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
77
* use this file except in compliance with the License. You may obtain a copy
@@ -20,6 +20,7 @@
2020

2121
import java.util.List;
2222
import java.util.Map;
23+
import org.jsonurl.j2se.JavaValueFactory;
2324
import org.junit.jupiter.api.Test;
2425

2526
/**

module/jsonurl-core/src/test/java/org/jsonurl/JavaValueParserTest.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
import static org.junit.jupiter.api.Assertions.assertNotNull;
2121

22+
import org.jsonurl.j2se.JavaValueFactory;
23+
import org.jsonurl.j2se.JsonUrlParser;
2224
import org.junit.jupiter.api.Test;
2325

2426
/**
@@ -29,7 +31,7 @@ class JavaValueParserTest {
2931

3032
@Test
3133
void testConstruct() {
32-
assertNotNull(new JavaValueParser());
33-
assertNotNull(new JavaValueParser(JavaValueFactory.PRIMITIVE));
34+
assertNotNull(new JsonUrlParser());
35+
assertNotNull(new JsonUrlParser(JavaValueFactory.PRIMITIVE));
3436
}
3537
}

module/jsonurl-core/src/test/java/org/jsonurl/PrimitiveParseTest.java

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package org.jsonurl;
22

3+
import org.jsonurl.j2se.JavaValueFactory;
4+
35
/*
46
* Copyright 2019 David MacCormack
57
*

module/jsonurl-jsonorg/src/main/java/org/jsonurl/jsonorg/JsonOrgServiceProvider.java

-36
This file was deleted.

module/jsonurl-jsonorg/src/main/java/org/jsonurl/jsonorg/JsonOrgValueFactory.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
import java.util.Set;
2121
import org.json.JSONArray;
2222
import org.json.JSONObject;
23-
import org.jsonurl.JavaValueFactory;
2423
import org.jsonurl.NumberBuilder;
2524
import org.jsonurl.NumberText;
2625
import org.jsonurl.ValueFactory;
2726
import org.jsonurl.ValueType;
27+
import org.jsonurl.j2se.JavaValueFactory;
2828

2929

3030
/**

module/jsonurl-jsr374/src/main/java/org/jsonurl/jsonp/JsonpServiceProvider.java

-36
This file was deleted.

snapshot.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
# version information used for building snapshots
33
#
44
parent.version=3-SNAPSHOT
5-
module.version=1.2.0-SNAPSHOT
5+
module.version=2.0.0-SNAPSHOT
66

0 commit comments

Comments
 (0)