Gentlemen,

Currently, a Reference instance may be in any state from empty, to invalid, to
relative, to absolute.  In any of those states it may or may not have a baseRef.
 No exceptions appear until certain getter methods are called.

I agree that we should be able to modify the parts of a Reference, but I will
argue the flexibility of having a Reference which cannot be resolved to an
absolute reference (e.g., relative internalRef with null baseRef) introduces
problems which are difficult to validate after the fact.

I humbly request that the Reference class attempts to be "fully-resolvable". 
This would require at least the following changes:

- remove default constructor
- validate that uriReference is absolute in constructor Reference(String
uriReference)
- validate that uriReference is relative in all Reference(Reference baseRef,
...) constructors
- isRelative() based on presence of baseRef
- set* methods on relative Reference throw IllegalArgumentException if
applicable (callers can use isRelative() to check beforehand)

These changes would allow some measure of consistency, keep the flexibility of
modifiable references, and simplify working with deep Reference chains.  I
imagine it would also simplify some of the code.

Your thoughts?  And, yes, since I'm making the proposal, I would be willing to
do the work.

Reply via email to