Nullability
NeQuissimus opened this issue · 4 comments
Is there a document or some logic I can read about which tells me about nullability of fields?
Do I have to assume that every field can potentially be null
?
You are targeting Java 7, so Optional
is not available. Is there a way the API could signal nullability?
This API returns empty model classes even if there is no corresponding object in the database record. However, all of the individual reference-type fields within a particular model may not be present and their corresponding getters will return null
if this is the case.
Right, so I will always receive an InsightsResponse
, for example, but from then on out, every field could potentially be null
?!
Any of our internal model classes will not be null, e.g., on InsightsResponse
, getTraits()
will return a non-null com.maxmind.geoip2.record.Traits
, but on Traits
, getConnectionType()
may return null
instead of a String
.
Thanks for the clarification.