A JVM parser for Improperties.
repositories {
mavenCentral()
}
dependencies {
implementation("coffee.cypher.impropriety:impropriety:latest.release")
}
<dependency>
<groupId>coffee.cypher.impropriety</groupId>
<artifactId>impropriety</artifactId>
<version>RELEASE</version>
</dependency>
//reading from a file
ImpropertiesReader reader = ImpropertiesReader.fromFile("some/file.improperties");
ImpObject tree = reader.toObject();
String value = tree.get("list").get(0).get("value").asValue().get();
//writing to a file
ImpropertiesWriter writer = new ImpropertiesWriter.Builder()
.indent(2)
.topLevelSpacing(1)
.innerSpacing(1)
.keyValueJoiner(": ")
.build();
Map<String, Object> data = someDataSource();
writer.writeToFile(data, "some_other/file.improperties")
//reading from a file
val reader = ImpropertiesReader.fromFile("some/file.improperties")
val tree = reader.toObject()
val value = tree["list"][0]["value"].asValue().get()
//writing to a file
val writer = ImpropertiesWriter(
indent = 2,
topLevelSpacing = 1,
innerSpacing = 1,
keyValueJoiner = ": "
)
val data: Map<String, Any> = someDataSource()
writer.writeToFile(data, "some_other/file.improperties")
- List markers must be followed by whitespace (
- element
, not-element
)
If you wish to use Impropriety's test fixtures in another project using Gradle, you can add them as a test dependency as follows.
dependencies {
testImplementation(testFixtures("coffee.cypher.impropriety:impropriety:latest.release"))
}