1 package com.atlassian.vcache.internal.guava;
2
3 /**
4 * Builder for {@link GuavaServiceSettings} instances.
5 *
6 * @since 1.0
7 */
8 public class GuavaServiceSettingsBuilder {
9 private boolean serializationHack;
10
11 /**
12 * Returns a new {@link GuavaServiceSettings} instance configured using the supplied settings.
13 *
14 * @return a new {@link GuavaServiceSettings} instance configured using the supplied settings.
15 */
16 public GuavaServiceSettings build() {
17 return new GuavaServiceSettings(serializationHack);
18 }
19
20 /**
21 * Enable the serialization hack, whereby if an {@link com.atlassian.vcache.ExternalCache}'s values are
22 * {@link java.io.Serializable}, then the values are not marshalled before they are passed to the delegate
23 * Guava Cache. This is to allow for performance optimisations.
24 */
25 public GuavaServiceSettingsBuilder enableSerializationHack() {
26 serializationHack = true;
27 return this;
28 }
29 }