JavaDoc comments added and method visibility raised to public

Signed-off-by: Dominic Schabel <dominic.schabel@bosch-si.com>
This commit is contained in:
Dominic Schabel
2016-08-05 14:12:27 +02:00
parent 41e7c16713
commit 222f06d9bb

View File

@@ -27,43 +27,84 @@ import org.eclipse.hawkbit.repository.model.EntityInterceptor;
*/ */
public class EntityInterceptorListener { public class EntityInterceptorListener {
/**
* Callback for lifecyle event <i>pre persist</i>.
*
* @param entity
* the JPA entity which this listener is associated with
*/
@PrePersist @PrePersist
protected void prePersist(final Object entity) { public void prePersist(final Object entity) {
notifyAll(interceptor -> interceptor.prePersist(entity)); notifyAll(interceptor -> interceptor.prePersist(entity));
} }
/**
* Callback for lifecyle event <i>post persist</i>.
*
* @param entity
* the JPA entity which this listener is associated with
*/
@PostPersist @PostPersist
protected void postPersist(final Object entity) { public void postPersist(final Object entity) {
notifyAll(interceptor -> interceptor.postPersist(entity)); notifyAll(interceptor -> interceptor.postPersist(entity));
} }
/**
* Callback for lifecyle event <i>post remove</i>.
*
* @param entity
* the JPA entity which this listener is associated with
*/
@PostRemove @PostRemove
protected void postRemove(final Object entity) { public void postRemove(final Object entity) {
notifyAll(interceptor -> interceptor.postRemove(entity)); notifyAll(interceptor -> interceptor.postRemove(entity));
} }
/**
* Callback for lifecyle event <i>pre remove</i>.
*
* @param entity
* the JPA entity which this listener is associated with
*/
@PreRemove @PreRemove
protected void preRemove(final Object entity) { public void preRemove(final Object entity) {
notifyAll(interceptor -> interceptor.preRemove(entity)); notifyAll(interceptor -> interceptor.preRemove(entity));
} }
/**
* Callback for lifecyle event <i>post load</i>.
*
* @param entity
* the JPA entity which this listener is associated with
*/
@PostLoad @PostLoad
protected void postLoad(final Object entity) { public void postLoad(final Object entity) {
notifyAll(interceptor -> interceptor.postLoad(entity)); notifyAll(interceptor -> interceptor.postLoad(entity));
} }
/**
* Callback for lifecyle event <i>pre update</i>.
*
* @param entity
* the JPA entity which this listener is associated with
*/
@PreUpdate @PreUpdate
protected void preUpdate(final Object entity) { public void preUpdate(final Object entity) {
notifyAll(interceptor -> interceptor.preUpdate(entity)); notifyAll(interceptor -> interceptor.preUpdate(entity));
} }
/**
* Callback for lifecyle event <i>post update</i>.
*
* @param entity
* the JPA entity which this listener is associated with
*/
@PostUpdate @PostUpdate
protected void postUpdate(final Object entity) { public void postUpdate(final Object entity) {
notifyAll(interceptor -> interceptor.postUpdate(entity)); notifyAll(interceptor -> interceptor.postUpdate(entity));
} }
private void notifyAll(final Consumer<? super EntityInterceptor> action) { private void notifyAll(final Consumer<? super EntityInterceptor> action) {
EntityInterceptorHolder.getInstance().getEntityInterceptors().forEach(action); EntityInterceptorHolder.getInstance().getEntityInterceptors().forEach(action);
} }
} }