Skip to content

Commit b09e8d8

Browse files
committed
Javadoc updates.
1 parent acf1144 commit b09e8d8

30 files changed

+254
-80
lines changed

README.md

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Minimal Object Description Language (MODL) Interpreter
2-
This Java interpreter is based on the [MODL ANTLR4 Grammar](https://github.com/MODLanguage/grammar-antlr4) and the [MODL Specification](http://www.modl.uk).
2+
This Java interpreter is based on the [MODL Specification](http://www.modl.uk).
33

44
There are several ways the interpreter can be used:
55

@@ -42,33 +42,25 @@ The `Interpreter` class has several convenience methods, each returning a slight
4242
### JSON String Result
4343
Convert a MODL String to a JSON String:
4444
```java
45-
final Interpreter interpreter = new Interpreter();
46-
47-
final String json = interpreter.interpretToJsonString("a=b");
45+
final String json = Interpreter.interpretToJsonString("a=b");
4846
```
4947
Use this method to generate a compact `JSON` String.
5048
### Pretty JSON String Result
5149
Convert a MODL String to a pretty-printed JSON String:
5250
```java
53-
final Interpreter interpreter = new Interpreter();
54-
55-
final String json = interpreter.interpretToPrettyJsonString("a=b");
51+
final String json = Interpreter.interpretToPrettyJsonString("a=b");
5652
```
5753
Use this method to generate a `JSON` String for easy reading.
5854
### Jackson Core JsonNode Result
5955
Convert a MODL String to a `JsonNode`:
6056
```java
61-
final Interpreter interpreter = new Interpreter();
62-
63-
final JsonNode jsonNode = interpreter.interpretToJsonObject("a=b");
57+
final JsonNode jsonNode = Interpreter.interpretToJsonObject("a=b");
6458
```
6559
Use this method to generate non-proprietary object for further processing.
6660
### Modl Object Result
6761
Convert a MODL String to a `Modl` object:
6862
```java
69-
final Interpreter interpreter = new Interpreter();
70-
71-
final Modl modl = interpreter.interpret("a=b");
63+
final Modl modl = Interpreter.interpret("a=b");
7264
```
7365
Use this method to generate an object using the core model within the library, i.e. those in the `uk.modl.model` package.
7466

@@ -77,4 +69,4 @@ Use this method to generate an object using the core model within the library, i
7769
We have a version of the interpreter in [Ruby](https://github.com/MODLanguage/ruby-interpreter), and a [JavaScript](https://www.npmjs.com/package/modl-interpreter) version.
7870
# Contributing
7971

80-
Bugs and New feature requests should be raised as GitHub issues, and the community is welcome to fork the repository and submit pull requests.
72+
Bugs and New feature requests should be raised as GitHub issues, and the community is welcome to fork the repository and submit pull requests.

build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1818
*
1919
*/
20+
//file:noinspection SpellCheckingInspection
2021

2122
buildscript {
2223

@@ -63,6 +64,7 @@ group = "uk.modl"
6364
applicationName = "java-interpreter"
6465
archivesBaseName = "java-interpreter"
6566
version = "1.0.0"
67+
mainClassName = "uk.modl.interpreter.Interpret"
6668

6769
def isSnapshot = version.endsWith("SNAPSHOT")
6870

@@ -82,7 +84,7 @@ dependencies {
8284
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.17.1'
8385

8486
// https://mvnrepository.com/artifact/io.vavr/vavr
85-
implementation 'io.vavr:vavr:0.10.4'
87+
compile 'io.vavr:vavr:0.10.4'
8688

8789
}
8890

client/index.html

Lines changed: 0 additions & 29 deletions
This file was deleted.

src/main/java/Interpret.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,6 @@
3131
*/
3232
@Log4j2
3333
public class Interpret {
34-
/**
35-
* The Interpreter
36-
*/
37-
private static final Interpreter interpreter = new Interpreter();
38-
3934
/**
4035
* Program entry point
4136
*
@@ -60,7 +55,7 @@ public static void main(final String... args) {
6055
final String modlString = String.join("\n", allLines);
6156

6257
// Interpret to formatted JSON
63-
final String result = interpreter.interpretToPrettyJsonString(modlString);
58+
final String result = Interpreter.interpretToPrettyJsonString(modlString);
6459

6560
// Log the result.
6661
log.info(result);

src/main/java/uk/modl/interpreter/Interpreter.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
import com.fasterxml.jackson.databind.JsonNode;
2424
import lombok.NonNull;
25+
import lombok.experimental.UtilityClass;
2526
import uk.modl.interpreter.model.Modl;
2627
import uk.modl.interpreter.parser.Parser;
2728

@@ -30,6 +31,7 @@
3031
*
3132
* @author tonywalmsley
3233
*/
34+
@UtilityClass
3335
public class Interpreter {
3436

3537
/**
@@ -39,7 +41,7 @@ public class Interpreter {
3941
* @return String
4042
*/
4143
public String interpretToJsonString(@NonNull final String s) {
42-
final JsonNode jsonObject = this.interpretToJsonObject(s);
44+
final JsonNode jsonObject = interpretToJsonObject(s);
4345
return JsonToString.convert(jsonObject);
4446
}
4547

@@ -50,7 +52,7 @@ public String interpretToJsonString(@NonNull final String s) {
5052
* @return String
5153
*/
5254
public String interpretToPrettyJsonString(@NonNull final String s) {
53-
final JsonNode jsonObject = this.interpretToJsonObject(s);
55+
final JsonNode jsonObject = interpretToJsonObject(s);
5456
return JsonToString.convertPretty(jsonObject);
5557
}
5658

@@ -61,7 +63,7 @@ public String interpretToPrettyJsonString(@NonNull final String s) {
6163
* @return JsonNode
6264
*/
6365
public JsonNode interpretToJsonObject(@NonNull final String s) {
64-
final Modl modl = this.interpret(s);
66+
final Modl modl = interpret(s);
6567
return ModlToJson.convert(modl);
6668
}
6769

@@ -72,7 +74,7 @@ public JsonNode interpretToJsonObject(@NonNull final String s) {
7274
* @return Modl
7375
*/
7476
public Modl interpret(@NonNull final String s) {
75-
return new Parser().parseModl(s);
77+
return Parser.parseModl(s);
7678
}
7779

7880
}

src/main/java/uk/modl/interpreter/model/Modl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import lombok.Value;
2828

2929
/**
30-
* An object to match the ANTLR4 MODL grammar
30+
* a MODL grammar object.
3131
*/
3232
@Value
3333
public class Modl {

src/main/java/uk/modl/interpreter/model/ModlArray.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import lombok.Value;
2727

2828
/**
29-
* An object to match the ANTLR4 MODL grammar
29+
* a MODL grammar object.
3030
*/
3131
@Value
3232
public class ModlArray implements ModlValue, ModlStructure {

src/main/java/uk/modl/interpreter/model/ModlBoolNull.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
package uk.modl.interpreter.model;
2222

2323
/**
24-
* An object to match the ANTLR4 MODL grammar
24+
* a MODL grammar object.
2525
*/
2626
public enum ModlBoolNull implements ModlPrimitive {
2727
MODL_TRUE, MODL_FALSE, MODL_NULL

src/main/java/uk/modl/interpreter/model/ModlFloat.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import lombok.Value;
2424

2525
/**
26-
* An object to match the ANTLR4 MODL grammar
26+
* a MODL grammar object.
2727
*/
2828
@Value
2929
public class ModlFloat implements ModlNumber {

src/main/java/uk/modl/interpreter/model/ModlInteger.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import lombok.Value;
2424

2525
/**
26-
* An object to match the ANTLR4 MODL grammar
26+
* a MODL grammar object.
2727
*/
2828
@Value
2929
public class ModlInteger implements ModlNumber {

0 commit comments

Comments
 (0)