using Invercargill; using InvercargillJson; namespace Binman { public Attempts get_composition(string path = "/etc/composition") throws Error { return new JsonlInputStream(File.new_for_path(path).read()) .as_property_groups() .try_map_with(CompositionComponent.get_mapper()); } public class CompositionComponent { public string name { get; set; } public BinaryData key { get; set; } public Vector uris { get; set; } public static PropertyMapper get_mapper() { return PropertyMapper.build_for(cfg => cfg .map("name", o => o.name, (o, v) => o.name = v) .map("key", o => o.key.to_base64(), (o, v) => o.key = new BinaryData.from_base64(v)) .map_many("uris", o => o.uris, (o, v) => o.uris = v.to_vector()) .set_constructor(() => new CompositionComponent()) ); } } }