net.infonode.properties.propertymap

Class PropertyMapManager

public class PropertyMapManager extends Object

Utility class for performing multiple modifications to {@link PropertyMap}'s and merging change notifications to optimize performance.

Version: $Revision: 1.16 $

Author: $Author: jesper $

Method Summary
voidbeginBatch()
Begins a batch operation.
voidendBatch()
Ends a batch operation.
static PropertyMapManagergetInstance()
Returns the only instance of this class.
static voidrunBatch(Runnable runnable)
Executes a method inside a {@link #beginBatch()} - {@link #endBatch()} pair.

Method Detail

beginBatch

public void beginBatch()
Begins a batch operation. This stores and merges all change notifications occuring in all property maps until {@link #endBatch} is called. Each call to this method MUST be followed by a call to {@link #endBatch}. This method can be called an unlimited number of times without calling {@link #endBatch} in between, but each call must have a corresponding call to {@link #endBatch}. Only when exiting from the outermost {@link #endBatch()} the changes be propagated to the listeners.

endBatch

public void endBatch()
Ends a batch operation. See {@link #beginBatch()} for more information.

getInstance

public static PropertyMapManager getInstance()
Returns the only instance of this class.

Returns: the only instance of this class

runBatch

public static void runBatch(Runnable runnable)
Executes a method inside a {@link #beginBatch()} - {@link #endBatch()} pair. See {@link #beginBatch()} for more information. It's safe to call other batch methods from inside {@link Runnable#run}.

Parameters: runnable the runnable to invoke