All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.yawp.repository.hooks.Hook Maven / Gradle / Ivy

There is a newer version: 2.08alpha
Show newest version
package io.yawp.repository.hooks;

import io.yawp.repository.Feature;
import io.yawp.repository.IdRef;
import io.yawp.repository.query.QueryBuilder;

/**
 * Hook API
 * 

* The Hook API is used to intercept and add custom logic to the default * lifecycle of an endpoint model from the request down to the repository. *

* All subclasses of this base class will be scanned at the bootstrap * of the framework. * * @param The endpoint model type. */ public class Hook extends Feature { /** * Override this method to be invoked before the {@link io.yawp.repository.shields.Shield} * is applied. * * @param object The endpoint model object being hooked. */ public void beforeShield(T object) { } /** * Override this method to be invoked right before the endpoint model * is saved. * * @param object The endpoint model object being hooked. */ public void beforeSave(T object) { } /** * Override this method to be invoked right after the endpoint model * is saved. * * @param object The endpoint model object being hooked. */ public void afterSave(T object) { } /** * Override this method to be invoked right before a query is executed * to this endpoint model. * * @param q The {@link QueryBuilder} being hooked. */ public void beforeQuery(QueryBuilder q) { } /** * Override this method to be invoked right before the endpoint model * is destroyed. * * @param object The endpoint model object being hooked. */ public void beforeDestroy(IdRef object) { } /** * Override this method to be invoked right after the endpoint model * is saved. * * @param object The endpoint model object being hooked. */ public void afterDestroy(IdRef object) { } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy