com.sleepycat.persist.evolve.EvolveConfig Maven / Gradle / Ivy
The newest version!
/*-
* Copyright (C) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
*
* This file was distributed by Oracle as part of a version of Oracle Berkeley
* DB Java Edition made available at:
*
* http://www.oracle.com/technetwork/database/database-technologies/berkeleydb/downloads/index.html
*
* Please see the LICENSE file included in the top-level directory of the
* appropriate version of Oracle Berkeley DB Java Edition for a copy of the
* license and additional information.
*/
package com.sleepycat.persist.evolve;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import com.sleepycat.persist.EntityStore;
/**
* Configuration properties for eager conversion of unevolved objects. This
* configuration is used with {@link EntityStore#evolve EntityStore.evolve}.
*
* @see com.sleepycat.persist.evolve Class Evolution
* @author Mark Hayes
*/
public class EvolveConfig implements Cloneable {
private Set classesToEvolve;
private EvolveListener evolveListener;
/**
* Creates an evolve configuration with default properties.
*/
public EvolveConfig() {
classesToEvolve = new HashSet();
}
/**
* Returns a shallow copy of the configuration.
*
* @return a shallow copy of the configuration.
*
* @deprecated As of JE 4.0.13, replaced by {@link
* EvolveConfig#clone()}.
*/
public EvolveConfig cloneConfig() {
try {
return (EvolveConfig) super.clone();
} catch (CloneNotSupportedException cannotHappen) {
return null;
}
}
/**
* Returns a shallow copy of the configuration.
*/
@Override
public EvolveConfig clone() {
try {
return (EvolveConfig) super.clone();
} catch (CloneNotSupportedException cannotHappen) {
return null;
}
}
/**
* Adds an entity class for a primary index to be converted. If no classes
* are added, all indexes that require evolution will be converted.
*
* @param entityClass the entity class name.
*
* @return 'this'.
*/
public EvolveConfig addClassToEvolve(String entityClass) {
classesToEvolve.add(entityClass);
return this;
}
/**
* Returns an unmodifiable set of the entity classes to be evolved.
*
* @return an unmodifiable set of the entity classes to be evolved.
*/
public Set getClassesToEvolve() {
return Collections.unmodifiableSet(classesToEvolve);
}
/**
* Sets a progress listener that is notified each time an entity is read.
*
* @param listener the EvolveListener.
*
* @return 'this'.
*/
public EvolveConfig setEvolveListener(EvolveListener listener) {
setEvolveListenerVoid(listener);
return this;
}
/**
*
* @hidden
*
* The void return setter for use by Bean editors.
*
* @param listener the EvolveListener.
*/
public void setEvolveListenerVoid(EvolveListener listener) {
this.evolveListener = listener;
}
/**
* Returns the progress listener that is notified each time an entity is
* read.
*
* @return the EvolveListener.
*/
public EvolveListener getEvolveListener() {
return evolveListener;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy