bolerio / mjson

Lean JSON Library for Java, with a compact, elegant API.
Apache License 2.0
82 stars 26 forks source link

more concise typed property values #13

Open bolerio opened 9 years ago

bolerio commented 9 years ago

The interface will of course fatten a bit, but that's also the point of having a single class. Instead of writing

object.at(propertyname).asString()

we could write

object.asString(propertyname)

or for arrays:

object.asString(10)

and like this for all asXXX methods.

Or drop the "as" here since we are not "at the value" yet to be say that we look at it "as something". So maybe just like this:

object.string(propname) object.bool(properyname)

that's even shorter, but the problem is new method names and less consistency with the rest of the API. Is saving a few characters worth the loss of consistency? Don't think so..