Skip to content

Constretto 2.0

Sondre Eikanger Kvalø edited this page Aug 13, 2013 · 1 revision

What’s new in 2.0

  • Json configuration support. You can now in your config files configure rich objects, arrays and maps
  • JsonStore added. Now you are able to register a new file with complex json content, and register it on a key and list of tags
  • New GenericConverter interface allowing you to create custom parsing for rich objects
  • Spring dependencies for the core api and implementation is removed
  • You can now query constretto for the currently used configuration tags
  • Overriding configuration by using System properties and System env are now enabled by default.
  • Cursored navigation with the “at” method is removed. Will break any clients using this feature.
  • @Configuration now uses value instead of expression so that instead of writing @Configuration(expression="aKey") now you simply say @Configuration("aKey")

Examples of the new json format

#
# Usage in java code :
# List<String> strings = config.evaluateToList(String.class,"anArrayOfStrings")
#
anArrayOfStrings = ["one","two","three"]

#
# Usage in java code :
# List<Integer> ints = config.evaluateToList(Integer.class,"anArrayOfInts")
#
anArrayOfInts = [1,2,3]

#
# Usage in java code :
# Map<String,Integer> map = config.evaluateToMap(String.class,Integer.class,"mapOfStringAndInt")
#
mapOfStringAndInt = {"keyOne":1,"keyTwo":2}

#
# Usage in java code :
# Person p = config.evaluateWith(new PersonConverter(),"aPerson")
# Where PersonConverter here is an implementation of GenericConverter
#
aPerson={"name":"Kaare",age:29,"adress",{"street":"somewhere","city":"over the rainbow"}}
Clone this wiki locally