I did have some weird questions related to that, because AP objects can theoretically have more than one type. Realistically though, you still need either reflection or a big honking switch statement to map AP types to your own classes, and from there you could as well treat those multiple-type objects as special cases.
JSON-LD processing algorithms on the other hand… I just gave up and made them use JSONObject
s, JSONArray
s, and simple Object
s throughout. In the spec, there are many places where something accepts an input that could be a number, a string, a JSON object, or an array — clearly written with something like JavaScript in mind. This was nightmarish to deal with.