ServerCacheControl extends CacheControl { @Override public ServerCacheControlBuilder toBuilder() { return new ServerCacheControlBuilder(this); } ServerCacheControl(boolean noCache, boolean noStore, boolean noTransform, long maxAgeSeconds,
                       boolean cachePublic, boolean cachePrivate, boolean immutable,
                       boolean mustRevalidate, boolean proxyRevalidate, long sMaxAgeSeconds); static ServerCacheControl parse(String... directives); static ServerCacheControl parse(Iterable<String> directives); static ServerCacheControlBuilder builder(); @Override boolean isEmpty(); boolean cachePublic(); boolean cachePrivate(); boolean immutable(); boolean mustRevalidate(); boolean proxyRevalidate(); long sMaxAgeSeconds(); @Override ServerCacheControlBuilder toBuilder(); @Override String asHeaderValue(); @Override boolean equals(@Nullable Object o); @Override int hashCode(); static final ServerCacheControl EMPTY; static final ServerCacheControl DISABLED; static final ServerCacheControl REVALIDATED; static final ServerCacheControl IMMUTABLE; }
@Test public void testToBuilder() { final ServerCacheControl cc = ServerCacheControl.builder() .cachePublic() .cachePrivate() .immutable() .mustRevalidate() .proxyRevalidate() .sMaxAgeSeconds(3600) .build(); assertThat(cc.asHeaderValue()) .isEqualTo("private, immutable, must-revalidate, proxy-revalidate, s-maxage=3600"); assertThat(cc.toBuilder().build()).isEqualTo(cc); assertThat(cc.toBuilder() .cachePrivate(false) .immutable(false) .mustRevalidate(false) .proxyRevalidate(false) .sMaxAge(null) .build().isEmpty()).isTrue(); }