Package org.coliper.ibean.extension
Contains all extension interfaces that are supported out of the box by IBean.
An extension interface adds cross-cutting functionality to bean interfaces.
Extension interfaces are enabled by adding them to the super-interface list
of the bean type. For example, to add extension interfaces
This package contains all built-in extension interfaces of the IBean framework.
NullSafe
and
Freezable
to bean type Customer they just
need to be listed in the extended clause:
public interface Customer extends NullSafe, Freezable {
...
Developers can define their own extension interfaces. See
ExtensionHandler
for a description how to do
this.This package contains all built-in extension interfaces of the IBean framework.
-
Interface Summary Interface Description CloneableBean<T> Enables cloning of beans viaObject.clone()
.Completable<T> Extension interface that allows runtime checking whether all fields of a bean have been initialized, that is, are not null.
The generic typeT
should always be set to the bean type.Freezable<T> Extension interface that allows setting the status of a bean to immutable ("frozen") by preventing all further setter calls.
The generic typeT
of this interface should be set to the bean type.GsonSupport Extension interface that makes IBeans serializable and deserializable with Gson.Jackson2Support Extension interface that makes IBeans serializable and deserializable with Jackson2.LazyInit Extension interface that supports with on-the-fly creation of nested IBeans.LazyInitChild Extension interface that supports with on-the-fly creation of nested IBeans.LazyInitParent Extension interface that supports with on-the-fly creation of nested IBeans.ModificationAware Extension interface that gives the possibility to check if a bean has been modified since creation or last reset of the modification flag (viaModificationAware.resetModified()
).
A bean is considered as modified as soon as a setter has been called, regardless if the setter call actually changed the value of the field.
If you need to know in detail which fields had been modified use sub interfaceModificationAwareExt
.ModificationAwareExt ExtendsModificationAware
with functionality to determine which fields have been modified.NullSafe Marker extension interface that injects getter calls in a way that if a getter is called on a field with valuenull
it throws anNullSafetyException
.TempFreezable<T> Extension of theFreezable
interface that gives the possibility to change a bean from an immutable (frozen) state back to a mutable state.
Could for example used to freeze beans only for usage in certain portions of the code where they are not supposed to be modified. -
Class Summary Class Description GsonSerializerDeserializerForIBeans JSON serializer/deserializer used withGson
to convert IBeans with extension interfaceGsonSupport
from and to JSON.Jackson2ModuleForIBeans Jackson2 configurationModule
for IBean support. -
Exception Summary Exception Description BeanFrozenException Thrown from beans that are extended withFreezable
interface when their status is frozen and a setter is called.BeanIncompleteException Thrown from beans that are extended with theCompletable
interface when callingCompletable.assertComplete()
in case the bean still has unset fields.NullSafetyException Thrown from getter methods from beans that extendNullSafe
in case the value of the field isnull
.