Package org.coliper.ibean.extension
Interface Freezable<T>
-
- All Known Subinterfaces:
TempFreezable<T>
- All Known Implementing Classes:
FreezableHandler
public interface Freezable<T>Extension interface that allows setting the status of a bean to immutable ("frozen") by preventing all further setter calls.
The generic typeTof this interface should be set to the bean type. The generic type is used infreeze()to allow chainingfreeze()to modern bean style setters.If you want to be able to make the bean immutable again use sub interface
TempFreezable.The bean instance is set to immutable (aka frozen) by calling
freeze(). All subsequent calls to any setter will cause aBeanFrozenExceptionto be thrown from the setter.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Tfreeze()Set the bean to immutable and prevents all further setter calls.booleanisFrozen()
-
-
-
Method Detail
-
freeze
T freeze()
Set the bean to immutable and prevents all further setter calls.- Returns:
- this (the bean itself); used for chaining with setter calls in
ModernBeanStyle
-
isFrozen
boolean isFrozen()
- Returns:
trueif the bean was switched to immutable with a previousfreeze()call
-
-