How can I extend java.net.URI - why is it final?
I am working on an ontology-related library and I am struggling with this problem: java.net.URI is final and therefore I cannot extend it.
Why on earth is it final?
And how can I work around this?
The problem is this: people who want to use that library already will be using java.net.URIs all over the place. So my methods should be able to accept java.net.URI as parameters.
However, the library should also be able to deal with IRIs (which are an extension of URIs in that they allow certain parts of the URI to be UTF-8 encoded) and Nodes (which in turn are an extension of IRIs in that Nodes alternatively can represent IRIs or blank nodes that have a blank node identifier).
The ideal way to do this would be to have the methods accept java.net.URI or some extension of it.
But with URI being defined final this does not seem to be possible.
So again: how does one solve this dilemma and why on earth is URI final?