Debian Codegraph @

lang/java/src/com/sleepycat/persist/evolve/EvolveConfig.java

raw
1 /*-
2 * See the file LICENSE for redistribution information.
3 *
4 * Copyright (c) 2002, 2013 Oracle and/or its affiliates. All rights reserved.
5 *
6 */
7
8 package com.sleepycat.persist.evolve;
9
10 import java.util.Collections;
11 import java.util.HashSet;
12 import java.util.Set;
13
14 import com.sleepycat.persist.EntityStore;
15
16 /**
17 * Configuration properties for eager conversion of unevolved objects. This
18 * configuration is used with {@link EntityStore#evolve EntityStore.evolve}.
19 *
20 * @see com.sleepycat.persist.evolve Class Evolution
21 * @author Mark Hayes
22 */
23 public class EvolveConfig implements Cloneable {
24
25 private Set<String> classesToEvolve;
26 private EvolveListener evolveListener;
27
28 /**
29 * Creates an evolve configuration with default properties.
30 */
31 public EvolveConfig() {
32 classesToEvolve = new HashSet<String>();
33 }
34
35 /**
36 * Returns a shallow copy of the configuration.
37 *
38 * @deprecated As of JE 4.0.13, replaced by {@link
39 * EvolveConfig#clone()}.</p>
40 */
41 public EvolveConfig cloneConfig() {
42 try {
43 return (EvolveConfig) super.clone();
44 } catch (CloneNotSupportedException cannotHappen) {
45 return null;
46 }
47 }
48
49 /**
50 * Returns a shallow copy of the configuration.
51 */
52 @Override
53 public EvolveConfig clone() {
54 try {
55 return (EvolveConfig) super.clone();
56 } catch (CloneNotSupportedException cannotHappen) {
57 return null;
58 }
59 }
60
61 /**
62 * Adds an entity class for a primary index to be converted. If no classes
63 * are added, all indexes that require evolution will be converted.
64 */
65 public EvolveConfig addClassToEvolve(String entityClass) {
66 classesToEvolve.add(entityClass);
67 return this;
68 }
69
70 /**
71 * Returns an unmodifiable set of the entity classes to be evolved.
72 */
73 public Set<String> getClassesToEvolve() {
74 return Collections.unmodifiableSet(classesToEvolve);
75 }
76
77 /**
78 * Sets a progress listener that is notified each time an entity is read.
79 */
80 public EvolveConfig setEvolveListener(EvolveListener listener) {
81 setEvolveListenerVoid(listener);
82 return this;
83 }
84
85 /**
86 * @hidden
87 * The void return setter for use by Bean editors.
88 */
89 public void setEvolveListenerVoid(EvolveListener listener) {
90 this.evolveListener = listener;
91 }
92
93 /**
94 * Returns the progress listener that is notified each time an entity is
95 * read.
96 */
97 public EvolveListener getEvolveListener() {
98 return evolveListener;
99 }
100 }