ClientCacheControl extends CacheControl { @Override public ClientCacheControlBuilder toBuilder() { return new ClientCacheControlBuilder(this); } ClientCacheControl(boolean noCache, boolean noStore, boolean noTransform, long maxAgeSeconds,
                       boolean onlyIfCached, long maxStaleSeconds, long minFreshSeconds,
                       long staleWhileRevalidateSeconds, long staleIfErrorSeconds); static ClientCacheControl parse(String... directives); static ClientCacheControl parse(Iterable<String> directives); static ClientCacheControlBuilder builder(); @Override boolean isEmpty(); boolean onlyIfCached(); boolean hasMaxStale(); long maxStaleSeconds(); long minFreshSeconds(); long staleWhileRevalidateSeconds(); long staleIfErrorSeconds(); @Override ClientCacheControlBuilder toBuilder(); @Override String asHeaderValue(); @Override boolean equals(@Nullable Object o); @Override int hashCode(); static final ClientCacheControl EMPTY; static final ClientCacheControl FORCE_NETWORK; static final ClientCacheControl FORCE_CACHE; }
@Test public void testToBuilder() { final ClientCacheControl cc = ClientCacheControl.builder() .onlyIfCached() .maxStaleSeconds(60) .minFreshSeconds(60) .staleWhileRevalidateSeconds(60) .staleIfErrorSeconds(60) .build(); assertThat(cc.asHeaderValue()).isEqualTo( "only-if-cached, max-stale=60, min-fresh=60, stale-while-revalidate=60, stale-if-error=60"); assertThat(cc.toBuilder().build()).isEqualTo(cc); assertThat(cc.toBuilder() .onlyIfCached(false) .maxStale(null) .minFresh(null) .staleWhileRevalidate(null) .staleIfError(null) .build().isEmpty()).isTrue(); }