com.softicar.platform.common.core.interfaces.IRefreshable Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of platform-common Show documentation
Show all versions of platform-common Show documentation
The SoftiCAR Platform is a lightweight, Java-based library to create interactive business web applications.
package com.softicar.platform.common.core.interfaces;
/**
* A simple interface for every thing that can be refreshed.
*
* @author Boris Schaa
* @author Oliver Richers
*/
public interface IRefreshable {
/**
* A default implementation that does nothing.
*/
IRefreshable NO_OPERATION = () -> {
// nothing to do by definition
};
void refresh();
/**
* Checks the given null-able {@link IRefreshable} and returns a non-null
* {@link IRefreshable}.
*
* If the given {@link IRefreshable} instance is null this returns
* {@link #NO_OPERATION}. Otherwise, the given {@link IRefreshable} instance
* is returned as it is.
*
* @param refreshable
* the {@link IRefreshable} instance (may be null)
* @return the given {@link IRefreshable} instance or {@link #NO_OPERATION}
*/
static IRefreshable ofNullable(IRefreshable refreshable) {
return refreshable == null? NO_OPERATION : refreshable;
}
}