liquibase.change
Class ChangeFactory

java.lang.Object
  extended by liquibase.change.ChangeFactory

public class ChangeFactory
extends Object

Factory class for constructing the correct liquibase.change.Change implementation based on a command name. For XML-based changelogs, the tag name is the command name. Change implementations are looked up via the ServiceLocator.

See Also:
Change

Method Summary
 void clear()
          Clear the registry of all Changes found.
 Change create(String name)
          Create a new Change implementation for the given change name.
 ChangeMetaData getChangeMetaData(Change change)
           
 Set<String> getDefinedChanges()
          Returns all defined changes in the registry.
static ChangeFactory getInstance()
          Return the singleton ChangeFactory instance.
 Map<String,SortedSet<Class<? extends Change>>> getRegistry()
          Return the registry of all Changes found.
 void register(Class<? extends Change> changeClass)
          Register a new Change class.
static void reset()
          Reset the ChangeFactory so it reloads the registry on the next call to @{link #getInstance()}.
 void unregister(String name)
          Unregister all instances of a given Change name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static ChangeFactory getInstance()
Return the singleton ChangeFactory instance.


reset

public static void reset()
Reset the ChangeFactory so it reloads the registry on the next call to @{link #getInstance()}. Mainly used in testing


register

public void register(Class<? extends Change> changeClass)
Register a new Change class. Normally called automatically by ChangeFactory on all Change implementations found by the ServiceLocator, but it can be called manually if needed.


getChangeMetaData

public ChangeMetaData getChangeMetaData(Change change)

unregister

public void unregister(String name)
Unregister all instances of a given Change name. Normally used for testing, but can be called manually if needed.


getRegistry

public Map<String,SortedSet<Class<? extends Change>>> getRegistry()
Return the registry of all Changes found. Key is the change name and the values are a sorted set of implementations, ordered by Priority descending. Normally used only for information/debugging purposes. The returned map is read only.


getDefinedChanges

public Set<String> getDefinedChanges()
Returns all defined changes in the registry. Returned set is not modifiable.


clear

public void clear()
Clear the registry of all Changes found. Normally used for testing.


create

public Change create(String name)
Create a new Change implementation for the given change name. The class of the constructed object will be the Change implementation with the highest priority. Each call to create will return a new instance of the Change.



Copyright © 2013 Liquibase.org. All Rights Reserved.