001    
002    /*
003     * Copyright (C) 2012 Archie L. Cobbs. All rights reserved.
004     *
005     * $Id: SpringPersistentObjectSchemaUpdate.java 226 2012-01-18 16:30:35Z archie.cobbs $
006     */
007    
008    package org.dellroad.stuff.pobj;
009    
010    import java.util.Collections;
011    import java.util.List;
012    
013    import org.dellroad.stuff.schema.AbstractSpringSchemaUpdate;
014    import org.dellroad.stuff.schema.DatabaseAction;
015    
016    /**
017     * Support superclass for Spring-enabled {@link org.dellroad.stuff.schema.SchemaUpdate}s for use with
018     * a {@link PersistentObjectSchemaUpdater}. Instances include a single {@link DatabaseAction} (namely, themselves).
019     *
020     * @param <T> type of the persistent object
021     */
022    public abstract class SpringPersistentObjectSchemaUpdate<T> extends AbstractSpringSchemaUpdate<PersistentFileTransaction>
023      implements DatabaseAction<PersistentFileTransaction> {
024    
025        /**
026         * Apply this update to the given transaction.
027         */
028        @Override
029        public abstract void apply(PersistentFileTransaction transaction);
030    
031        @Override
032        public final List<SpringPersistentObjectSchemaUpdate<T>> getDatabaseActions() {
033            return Collections.singletonList(this);
034        }
035    }
036