Skip to content

Commit 3548e6e

Browse files
committed
release v2.1.0
1 parent 8e69a16 commit 3548e6e

File tree

5 files changed

+47
-30
lines changed

5 files changed

+47
-30
lines changed

README.md

+19-2
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,37 @@ Releases are available from Maven Central
1818
<dependency>
1919
<groupId>com.singingbush</groupId>
2020
<artifactId>sdlang</artifactId>
21-
<version>2.0.1</version>
21+
<version>2.1.0</version>
2222
</dependency>
2323
```
2424

2525
### Usage
2626

2727
To parse an SDL file simply create an InputStreamReader and pass it into the constructor of Parser:
2828

29-
```Java
29+
```java
3030
final InputStream inputStream = new FileInputStream("c:\\data\\myfile.sdl");
3131
final Reader inputStreamReader = new InputStreamReader(inputStream, "UTF-8");
3232
final List<Tag> tags = new Parser(inputStreamReader).parse();
3333
```
3434

35+
To write SDL from Java objects:
36+
37+
```java
38+
final Tag tag = SDL.tag("thing")
39+
.withNamespace("my")
40+
.withComment("This text will precede the 'my:thing' when serialised")
41+
.withValue(SDL.value('g'))
42+
.withChild(SDL.tag("child")
43+
.withComment("child tags can also have comments")
44+
.withValues(SDL.value(ZonedDateTime.now()), SDL.value("some text"))
45+
.build()
46+
)
47+
.withAttribute("flt", SDL.value(0.0f))
48+
.withAttribute("lng", SDL.value(1_000L))
49+
.build();
50+
```
51+
3552
### Forked from [ikayzo/SDL](https://github.com/ikayzo/SDL):
3653

3754
This code was originally dumped in github in May 2011 with a single commit message stating that it was migrated from svn.

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.singingbush</groupId>
88
<artifactId>sdlang</artifactId>
9-
<version>2.0.2-SNAPSHOT</version>
9+
<version>2.1.0</version>
1010
<name>SDLang</name>
1111
<description>Support for SDLang (Simple Declarative Language)</description>
1212
<url>https://github.com/SingingBush/SDL</url>

src/main/java/com/singingbush/sdl/SDL.java

+13-13
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ public static void validateIdentifier(String identifier) {
319319
/**
320320
* @param name must be a legal SDL identifier (see {@link SDL#validateIdentifier(String)})
321321
* @return a {@link TagBuilder} which can be used to easily create a {@link Tag}
322-
* @since 2.0.2
322+
* @since 2.1.0
323323
*/
324324
public static TagBuilder tag(final String name) {
325325
return new TagBuilder(name);
@@ -329,7 +329,7 @@ public static TagBuilder tag(final String name) {
329329
* @param value text to be converted to SDL
330330
* @param literal in SDLang multiline strings are supported
331331
* @return an SDL string
332-
* @since 2.0.2
332+
* @since 2.1.0
333333
*/
334334
public static SdlValue<String> value(final String value, final boolean literal) {
335335
return literal?
@@ -340,7 +340,7 @@ public static SdlValue<String> value(final String value, final boolean literal)
340340
/**
341341
* @param value text to be converted to SDL
342342
* @return an SDL char
343-
* @since 2.0.2
343+
* @since 2.1.0
344344
*/
345345
public static SdlValue<Character> value(final char value) {
346346
return new SdlValue<>(value, SdlType.CHARACTER);
@@ -349,7 +349,7 @@ public static SdlValue<Character> value(final char value) {
349349
/**
350350
* @param value text to be converted to SDL
351351
* @return an SDL boolean
352-
* @since 2.0.2
352+
* @since 2.1.0
353353
*/
354354
public static SdlValue<Boolean> value(final boolean value) {
355355
return new SdlValue<>(value, SdlType.BOOLEAN);
@@ -358,7 +358,7 @@ public static SdlValue<Boolean> value(final boolean value) {
358358
/**
359359
* @param value text to be converted to SDL
360360
* @return an SDL long
361-
* @since 2.0.2
361+
* @since 2.1.0
362362
*/
363363
public static SdlValue<Long> value(final long value) {
364364
return new SdlValue<>(value, SdlType.NUMBER);
@@ -367,7 +367,7 @@ public static SdlValue<Long> value(final long value) {
367367
/**
368368
* @param value text to be converted to SDL
369369
* @return an SDL float
370-
* @since 2.0.2
370+
* @since 2.1.0
371371
*/
372372
public static SdlValue<Float> value(final float value) {
373373
return new SdlValue<>(value, SdlType.NUMBER);
@@ -376,7 +376,7 @@ public static SdlValue<Float> value(final float value) {
376376
/**
377377
* @param value text to be converted to SDL
378378
* @return an SDL double
379-
* @since 2.0.2
379+
* @since 2.1.0
380380
*/
381381
public static SdlValue<Double> value(final double value) {
382382
return new SdlValue<>(value, SdlType.NUMBER);
@@ -385,7 +385,7 @@ public static SdlValue<Double> value(final double value) {
385385
/**
386386
* @param value text to be converted to SDL
387387
* @return an SDL integer
388-
* @since 2.0.2
388+
* @since 2.1.0
389389
*/
390390
public static SdlValue<Integer> value(final int value) {
391391
return new SdlValue<>(value, SdlType.NUMBER);
@@ -394,7 +394,7 @@ public static SdlValue<Integer> value(final int value) {
394394
/**
395395
* @param value text to be converted to SDL
396396
* @return an SDL date
397-
* @since 2.0.2
397+
* @since 2.1.0
398398
*/
399399
public static SdlValue<LocalDate> value(final LocalDate value) {
400400
return new SdlValue<>(value, SdlType.DATE);
@@ -403,7 +403,7 @@ public static SdlValue<LocalDate> value(final LocalDate value) {
403403
/**
404404
* @param value text to be converted to SDL
405405
* @return an SDL datetime without timezone
406-
* @since 2.0.2
406+
* @since 2.1.0
407407
*/
408408
public static SdlValue<LocalDateTime> value(final LocalDateTime value) {
409409
return new SdlValue<>(value, SdlType.DATETIME);
@@ -412,7 +412,7 @@ public static SdlValue<LocalDateTime> value(final LocalDateTime value) {
412412
/**
413413
* @param value text to be converted to SDL
414414
* @return an SDL datetime with timezone
415-
* @since 2.0.2
415+
* @since 2.1.0
416416
*/
417417
public static SdlValue<ZonedDateTime> value(final ZonedDateTime value) {
418418
return new SdlValue<>(value, SdlType.DATETIME);
@@ -421,7 +421,7 @@ public static SdlValue<ZonedDateTime> value(final ZonedDateTime value) {
421421
/**
422422
* @param value text to be converted to SDL
423423
* @return an SDL timespan
424-
* @since 2.0.2
424+
* @since 2.1.0
425425
*/
426426
public static SdlValue<Duration> value(final Duration value) {
427427
return new SdlValue<>(value, SdlType.DURATION);
@@ -430,7 +430,7 @@ public static SdlValue<Duration> value(final Duration value) {
430430
/**
431431
* @param value text to be converted to SDL
432432
* @return an SDL binary
433-
* @since 2.0.2
433+
* @since 2.1.0
434434
*/
435435
public static SdlValue value(final byte[] value) {
436436
return new SdlValue<>(value, SdlType.BINARY);

src/main/java/com/singingbush/sdl/Tag.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ public class Tag implements Serializable {
354354
/**
355355
* Creates an empty tag.
356356
*
357-
* @deprecated As of release 2.0.2, use {@link SDL#tag(String)} instead.
357+
* @deprecated As of release 2.1.0, use {@link SDL#tag(String)} instead.
358358
* This constructor will be made package-private in a future release
359359
* @param name The name of this tag
360360
* @throws IllegalArgumentException if the name is not a legal SDL
@@ -369,7 +369,7 @@ public Tag(String name) {
369369
* Creates an empty tag in the given namespace. If the namespace is null
370370
* it will be coerced to an empty String.
371371
*
372-
* @deprecated As of release 2.0.2, use {@link SDL#tag(String)} instead.
372+
* @deprecated As of release 2.1.0, use {@link SDL#tag(String)} instead.
373373
* This constructor will be made package-private in a future release
374374
* @param namespace The namespace for this tag
375375
* @param name The name of this tag

src/main/java/com/singingbush/sdl/TagBuilder.java

+12-12
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
/**
1212
* @author Samael Bate (singingbush)
1313
* created on 20/07/18
14-
* @since 2.0.2
14+
* @since 2.1.0
1515
*/
1616
public class TagBuilder {
1717

@@ -24,7 +24,7 @@ public class TagBuilder {
2424

2525
/**
2626
* @param name must be a legal SDL identifier (see {@link SDL#validateIdentifier(String)})
27-
* @since 2.0.2
27+
* @since 2.1.0
2828
*/
2929
TagBuilder(@NotNull final String name) {
3030
this.name = name;
@@ -34,7 +34,7 @@ public class TagBuilder {
3434
* In SDL you can optionally specify a namespace
3535
* @param name must be a legal SDL identifier (see {@link SDL#validateIdentifier(String)})
3636
* @return this TagBuilder
37-
* @since 2.0.2
37+
* @since 2.1.0
3838
*/
3939
@NotNull
4040
public TagBuilder withNamespace(@NotNull final String name) {
@@ -46,7 +46,7 @@ public TagBuilder withNamespace(@NotNull final String name) {
4646
*
4747
* @param comment a single line of text that will precede the tag when serialised
4848
* @return this TagBuilder
49-
* @since 2.0.2
49+
* @since 2.1.0
5050
*/
5151
public TagBuilder withComment(@NotNull final String comment) {
5252
this.comment = comment;
@@ -57,7 +57,7 @@ public TagBuilder withComment(@NotNull final String comment) {
5757
* In SDL you can optionally have one or more values
5858
* @param value an SDL object, see {@link SdlValue}
5959
* @return this TagBuilder
60-
* @since 2.0.2
60+
* @since 2.1.0
6161
*/
6262
@NotNull
6363
public TagBuilder withValue(@NotNull final SdlValue value) {
@@ -69,7 +69,7 @@ public TagBuilder withValue(@NotNull final SdlValue value) {
6969
* In SDL you can optionally have one or more values
7070
* @param values multiple SDL objects, see {@link SdlValue}
7171
* @return this TagBuilder
72-
* @since 2.0.2
72+
* @since 2.1.0
7373
*/
7474
@NotNull
7575
public TagBuilder withValues(@NotNull final SdlValue... values) {
@@ -81,7 +81,7 @@ public TagBuilder withValues(@NotNull final SdlValue... values) {
8181
* In SDL you can optionally have one or more values
8282
* @param values multiple SDL objects, see {@link SdlValue}
8383
* @return this TagBuilder
84-
* @since 2.0.2
84+
* @since 2.1.0
8585
*/
8686
@NotNull
8787
public TagBuilder withValues(@NotNull final List<SdlValue> values) {
@@ -93,7 +93,7 @@ public TagBuilder withValues(@NotNull final List<SdlValue> values) {
9393
* In SDL you can optionally have one or more children
9494
* @param child a child {@link Tag} object
9595
* @return this TagBuilder
96-
* @since 2.0.2
96+
* @since 2.1.0
9797
*/
9898
@NotNull
9999
public TagBuilder withChild(@NotNull final Tag child) {
@@ -105,7 +105,7 @@ public TagBuilder withChild(@NotNull final Tag child) {
105105
* In SDL you can optionally have one or more children
106106
* @param children multiple child {@link Tag} objects
107107
* @return this TagBuilder
108-
* @since 2.0.2
108+
* @since 2.1.0
109109
*/
110110
@NotNull
111111
public TagBuilder withChildren(@NotNull final Tag... children) {
@@ -117,7 +117,7 @@ public TagBuilder withChildren(@NotNull final Tag... children) {
117117
* In SDL you can optionally have one or more children
118118
* @param children multiple child {@link Tag} objects
119119
* @return this TagBuilder
120-
* @since 2.0.2
120+
* @since 2.1.0
121121
*/
122122
@NotNull
123123
public TagBuilder withChildren(@NotNull final List<Tag> children) {
@@ -130,7 +130,7 @@ public TagBuilder withChildren(@NotNull final List<Tag> children) {
130130
* @param key attribute key
131131
* @param value attribute value
132132
* @return this TagBuilder
133-
* @since 2.0.2
133+
* @since 2.1.0
134134
*/
135135
@NotNull
136136
public TagBuilder withAttribute(@NotNull final String key, @NotNull final SdlValue value) {
@@ -142,7 +142,7 @@ public TagBuilder withAttribute(@NotNull final String key, @NotNull final SdlVal
142142
* In SDL you can optionally have one or more attributes
143143
* @param attributes multiple attributes
144144
* @return this TagBuilder
145-
* @since 2.0.2
145+
* @since 2.1.0
146146
*/
147147
@NotNull
148148
public TagBuilder withAttributes(@NotNull final Map<String, SdlValue> attributes) {

0 commit comments

Comments
 (0)