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 type T of this interface should be set to the bean type. The generic type is used in freeze() to allow chaining freeze() 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 a BeanFrozenException to be thrown from the setter.

    • 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:
        true if the bean was switched to immutable with a previous freeze() call