On Nov 29, 2007, at 3:18 PM, Jerome Louvel wrote:

It could have methods starting with "append" like the StringBuilder class,
and follow the Reference naming convention. For example it could have:

 - appendScheme(String scheme)
 - appendSchemeSpecificPart(String ssp)
 - appendFragment(String fragment)
 - appendHierarchicalPart(String ssp)
 - appendAuthority(String authority)
 - appendPath(String path)
 - appendSegment(String segment)
 - appendMatrixParam(String name, String value)
 - appendQuery(String query)
 - appendQueryParam(String name, String value)

Except it's not "append": it's "insert into the right place" or "set".

It should force the reference to be built in the correct order so an
efficient StringBuilder could be used internally and should guide the
developer with clear warning messages when parts are not appended in the
right order.

Why should it enforce the order? The burden should be on the implementor, not the user. Don't use a StringBuilder: use simple fields:

        class URI {
            private String scheme;
            private String host;
            // ...
        }

- Paul

Reply via email to