com.laamella:s-properties

S-Expression support for Java

License

License

GroupId

GroupId

com.laamella
ArtifactId

ArtifactId

s-properties
Last Version

Last Version

0.2
Release Date

Release Date

Type

Type

jar
Description

Description

com.laamella:s-properties
S-Expression support for Java

Download s-properties

How to add to project

<!-- https://jarcasting.com/artifacts/com.laamella/s-properties/ -->
<dependency>
    <groupId>com.laamella</groupId>
    <artifactId>s-properties</artifactId>
    <version>0.2</version>
</dependency>
// https://jarcasting.com/artifacts/com.laamella/s-properties/
implementation 'com.laamella:s-properties:0.2'
// https://jarcasting.com/artifacts/com.laamella/s-properties/
implementation ("com.laamella:s-properties:0.2")
'com.laamella:s-properties:jar:0.2'
<dependency org="com.laamella" name="s-properties" rev="0.2">
  <artifact name="s-properties" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.laamella', module='s-properties', version='0.2')
)
libraryDependencies += "com.laamella" % "s-properties" % "0.2"
[com.laamella/s-properties "0.2"]

Dependencies

compile (1)

Group / Artifact Type Version
com.laamella : s-expressions jar 0.2

test (1)

Group / Artifact Type Version
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

s-expressions library for Java

S-Expressions are a very simple, very flexible data format. It describes tree structures, or in this case: lists of lists or strings.

Goals

Have a simple, efficient format for...

  • data transfer
  • configuration files
  • object serialization

Additionally, make the API flexible enough to support other use cases, like implementing a Lisp.

Examples

Sample for serialization

TODO

Sample for configuration files

A simple configuration file reader is supplied. It can read the following kind of property files:

; Sample config file
; At the lowest level, we have a key->value mapping
(key value)
(keys-dont-have-spaces but the values can have spaces. All    whitespace    is turned into a single space.)
(but! "when you quote a value, spaces    are     retained")
(my-value-is-an-empty-string)

; Here we have a hierarchy.
(application
  (window
     (width 320)
     (height 200)
     (x 100)
     (y 100))
  (name Hello World!))

It can be read as if it were a .properties file:

SProperties properties = new SProperties();
properties.load("/config.s");

properties.get("application.window.height").ifPresent(System.out::println);

for (Map.Entry<String, String> e : properties) {
    System.out.println(e.getKey() + "->" + e.getValue());
}

Sample for data storage

TODO

com.laamella

Laamella Gad

Versions

Version
0.2