Ian Warwick
01/02/2020, 9:29 AMZsolt
01/02/2020, 9:37 AMIan Warwick
01/02/2020, 9:41 AMZsolt
01/02/2020, 10:29 AMIan Warwick
01/02/2020, 10:51 AMUri
would ensure valid URI's though I don't like it, for strong typedness definetly sealed classes are the way to go, something for me to think about thanks! 🙂Paul Woitaschek
01/02/2020, 2:19 PMpublic static Uri parse(String uriString) {
return new StringUri(uriString);
}
private StringUri(String uriString) {
if (uriString == null) {
throw new NullPointerException("uriString");
}
this.uriString = uriString;
}
Ian Warwick
01/02/2020, 2:21 PMPaul Woitaschek
01/02/2020, 2:22 PM/**
* Creates a Uri which parses the given encoded URI string.
*
* @param uriString an RFC 2396-compliant, encoded URI
* @throws NullPointerException if uriString is null
* @return Uri for this given uri string
*/
Ian Warwick
01/02/2020, 2:25 PMUri.parse("abc")
! 😆shikasd
01/02/2020, 5:05 PM/user/1/gallery
as a route, meaning you have gallery
in user
screen.
However, you can do /user/1/not-gallery
, it will pass validation, but will be logically incorrect, as you don't have not-gallery
in user
screen.Zsolt
01/03/2020, 12:31 AM