Package com.exedio.cope
Class DefaultChangeHook
- java.lang.Object
-
- com.exedio.cope.DefaultChangeHook
-
- All Implemented Interfaces:
ChangeHook
public final class DefaultChangeHook extends Object implements ChangeHook
Implements aChangeHook
that callsstatic beforeNewCopeItem(SetValue[])
,Item.afterNewCopeItem
,Item.beforeSetCopeItem
, andItem.beforeDeleteCopeItem
according to their specifications. Without this hook, these methods are not called at all. IfModelBuilder.changeHooks
is not called, this hook is installed by default.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.exedio.cope.ChangeHook
ChangeHook.Factory
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterNew(Item item)
Is called after any item creation.void
beforeDelete(Item item)
Is called before any item deletion.SetValue<?>[]
beforeNew(Type<?> type, SetValue<?>[] setValues)
Is called before any item creation.SetValue<?>[]
beforeSet(Item item, SetValue<?>[] setValues)
Is called before any item modification.static ChangeHook.Factory
factory()
String
toString()
-
-
-
Method Detail
-
factory
public static ChangeHook.Factory factory()
-
beforeNew
public SetValue<?>[] beforeNew(Type<?> type, SetValue<?>[] setValues)
Description copied from interface:ChangeHook
Is called before any item creation. You may change the values of the newly created item by returning changedsetValues
. The default implementation does nothing and returnssetValues
unmodified.- Specified by:
beforeNew
in interfaceChangeHook
-
afterNew
public void afterNew(Item item)
Description copied from interface:ChangeHook
Is called after any item creation. The default implementation does nothing.- Specified by:
afterNew
in interfaceChangeHook
- See Also:
Item.afterNewCopeItem()
-
beforeSet
public SetValue<?>[] beforeSet(Item item, SetValue<?>[] setValues)
Description copied from interface:ChangeHook
Is called before any item modification. The default implementation does nothing.- Specified by:
beforeSet
in interfaceChangeHook
setValues
- is never null and never empty- Returns:
- must not return null
- See Also:
Item.beforeSetCopeItem(SetValue[])
-
beforeDelete
public void beforeDelete(Item item)
Description copied from interface:ChangeHook
Is called before any item deletion. The default implementation does nothing.- Specified by:
beforeDelete
in interfaceChangeHook
- See Also:
Item.beforeDeleteCopeItem()
-
-