@Test public void testToString() throws Exception { assertEquals("http: new StructuredUri(new StringScheme("http"), new EncodedAuthority(new Precoded("example.com")), new EncodedPath(new Precoded("/test")), new SimpleQuery(new Precoded("x=y")), new SimpleFragment(new Precoded("123")))).toString()); assertEquals("http: new StructuredUri(new StringScheme("http"), new EncodedAuthority(new Precoded("example.com")), new EncodedPath(new Precoded("/test")), new SimpleQuery(new Precoded("x=y")))).toString()); assertEquals("/test?x=y", new Text( new RelativeUri(new EncodedPath(new Precoded("/test")), new SimpleQuery(new Precoded("x=y")))).toString()); }
@Override public String toString() { if (mString == null) { StringBuilder stringBuilder = new StringBuilder(128); if (mUri.scheme().isPresent()) { stringBuilder.append(mUri.scheme().value().toString()); stringBuilder.append(':'); } Optional<? extends Authority> optAuthority = mUri.authority(); if (optAuthority.isPresent()) { stringBuilder.append('/'); stringBuilder.append('/'); stringBuilder.append(new org.dmfs.rfc3986.authorities.Text(optAuthority.value())); } stringBuilder.append(new org.dmfs.rfc3986.paths.Text(mUri.path())); Optional<? extends Query> optQuery = mUri.query(); if (optQuery.isPresent()) { stringBuilder.append('?'); stringBuilder.append(optQuery.value()); } Optional<? extends Fragment> optFragment = mUri.fragment(); if (optFragment.isPresent()) { stringBuilder.append('#'); stringBuilder.append(optFragment.value()); } mString = stringBuilder.toString(); } return mString; }
Text implements CharSequence { @Override public String toString() { if (mString == null) { StringBuilder stringBuilder = new StringBuilder(128); if (mUri.scheme().isPresent()) { stringBuilder.append(mUri.scheme().value().toString()); stringBuilder.append(':'); } Optional<? extends Authority> optAuthority = mUri.authority(); if (optAuthority.isPresent()) { stringBuilder.append('/'); stringBuilder.append('/'); stringBuilder.append(new org.dmfs.rfc3986.authorities.Text(optAuthority.value())); } stringBuilder.append(new org.dmfs.rfc3986.paths.Text(mUri.path())); Optional<? extends Query> optQuery = mUri.query(); if (optQuery.isPresent()) { stringBuilder.append('?'); stringBuilder.append(optQuery.value()); } Optional<? extends Fragment> optFragment = mUri.fragment(); if (optFragment.isPresent()) { stringBuilder.append('#'); stringBuilder.append(optFragment.value()); } mString = stringBuilder.toString(); } return mString; } }
Text implements CharSequence { @Override public String toString() { if (mString == null) { StringBuilder stringBuilder = new StringBuilder(128); if (mUri.scheme().isPresent()) { stringBuilder.append(mUri.scheme().value().toString()); stringBuilder.append(':'); } Optional<? extends Authority> optAuthority = mUri.authority(); if (optAuthority.isPresent()) { stringBuilder.append('/'); stringBuilder.append('/'); stringBuilder.append(new org.dmfs.rfc3986.authorities.Text(optAuthority.value())); } stringBuilder.append(new org.dmfs.rfc3986.paths.Text(mUri.path())); Optional<? extends Query> optQuery = mUri.query(); if (optQuery.isPresent()) { stringBuilder.append('?'); stringBuilder.append(optQuery.value()); } Optional<? extends Fragment> optFragment = mUri.fragment(); if (optFragment.isPresent()) { stringBuilder.append('#'); stringBuilder.append(optFragment.value()); } mString = stringBuilder.toString(); } return mString; } Text(Uri uri); }
Text implements CharSequence { @Override public String toString() { if (mString == null) { StringBuilder stringBuilder = new StringBuilder(128); if (mUri.scheme().isPresent()) { stringBuilder.append(mUri.scheme().value().toString()); stringBuilder.append(':'); } Optional<? extends Authority> optAuthority = mUri.authority(); if (optAuthority.isPresent()) { stringBuilder.append('/'); stringBuilder.append('/'); stringBuilder.append(new org.dmfs.rfc3986.authorities.Text(optAuthority.value())); } stringBuilder.append(new org.dmfs.rfc3986.paths.Text(mUri.path())); Optional<? extends Query> optQuery = mUri.query(); if (optQuery.isPresent()) { stringBuilder.append('?'); stringBuilder.append(optQuery.value()); } Optional<? extends Fragment> optFragment = mUri.fragment(); if (optFragment.isPresent()) { stringBuilder.append('#'); stringBuilder.append(optFragment.value()); } mString = stringBuilder.toString(); } return mString; } Text(Uri uri); @Override int length(); @Override char charAt(int i); @Override CharSequence subSequence(int i, int i1); @Override String toString(); }
Text implements CharSequence { @Override public String toString() { if (mString == null) { StringBuilder stringBuilder = new StringBuilder(128); if (mUri.scheme().isPresent()) { stringBuilder.append(mUri.scheme().value().toString()); stringBuilder.append(':'); } Optional<? extends Authority> optAuthority = mUri.authority(); if (optAuthority.isPresent()) { stringBuilder.append('/'); stringBuilder.append('/'); stringBuilder.append(new org.dmfs.rfc3986.authorities.Text(optAuthority.value())); } stringBuilder.append(new org.dmfs.rfc3986.paths.Text(mUri.path())); Optional<? extends Query> optQuery = mUri.query(); if (optQuery.isPresent()) { stringBuilder.append('?'); stringBuilder.append(optQuery.value()); } Optional<? extends Fragment> optFragment = mUri.fragment(); if (optFragment.isPresent()) { stringBuilder.append('#'); stringBuilder.append(optFragment.value()); } mString = stringBuilder.toString(); } return mString; } Text(Uri uri); @Override int length(); @Override char charAt(int i); @Override CharSequence subSequence(int i, int i1); @Override String toString();  }