1 package com.atlassian.vcache.internal.legacy;
2
3 /**
4 * Builder for {@link LegacyServiceSettings} instances.
5 *
6 * @since 1.0
7 */
8 public class LegacyServiceSettingsBuilder {
9 private boolean avoidCasOps;
10 private boolean serializationHack;
11
12 /**
13 * Returns a new {@link LegacyServiceSettings} instance configured using the supplied settings.
14 *
15 * @return a new {@link LegacyServiceSettings} instance configured using the supplied settings.
16 */
17 public LegacyServiceSettings build() {
18 return new LegacyServiceSettings(avoidCasOps, serializationHack);
19 }
20
21 /**
22 * Enable avoiding the use of <tt>CAS-style</tt> operations. Really, really do not turn this setting on.
23 */
24 public LegacyServiceSettingsBuilder enableAvoidCasOperations() {
25 avoidCasOps = true;
26 return this;
27 }
28
29 /**
30 * Enable the serialization hack, whereby if an {@link com.atlassian.vcache.ExternalCache}'s values are
31 * {@link java.io.Serializable}, then the values are not marshalled before they are passed to the delegate
32 * Atlassian Cache. This is to allow for performance optimisations.
33 */
34 public LegacyServiceSettingsBuilder enableSerializationHack() {
35 serializationHack = true;
36 return this;
37 }
38 }