Skip to content

Extract from Lists and Map of Maps

Compare
Choose a tag to compare
@akshaisarma akshaisarma released this 30 Oct 22:14
· 78 commits to master since this release

This release adds a new Object extractField(String) to a BulletRecord that allows you to denote fields and nested fields using a simple notation to pull them out from the record.

Example:

extractField("foo") will return the field "foo" from the BulletRecord or null
extractField("foo.bar") will return the field "bar" from the Map "foo" in the BulletRecord or null
extractField("foo.bar.baz") will return the field "baz" from the Map "bar" in the Map "foo" in the BulletRecord or null
extractField("qux.0") will return the first element from the List "qux" in the BulletRecord or null
extractField("qux.1.norf") will return the field "norf" from the second Map from the List "qux" in the BulletRecord or null

This makes it easy to access all the types the BulletRecord supports. New get helper methods for Maps of Maps and Lists have been added

Object get(String): Get Top Level fields
Object get(String, String): Get Map fields
Object get(String, int): Get List index items
Object get(String, int, String): Get List index Map field items