io.github.nichetoolkit.rest.util.OptionalUtils Maven / Gradle / Ivy
Show all versions of rest-toolkit-utils Show documentation
package io.github.nichetoolkit.rest.util;
import io.github.nichetoolkit.rest.RestError;
import io.github.nichetoolkit.rest.RestException;
import io.github.nichetoolkit.rest.RestOptional;
import io.github.nichetoolkit.rest.actuator.*;
import io.github.nichetoolkit.rest.error.data.*;
import io.github.nichetoolkit.rest.error.often.FieldNullException;
import io.github.nichetoolkit.rest.error.often.FieldRepeatException;
import io.github.nichetoolkit.rest.error.often.IdentityNullException;
import io.github.nichetoolkit.rest.error.often.NameRepeatException;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.springframework.lang.NonNull;
import org.springframework.lang.Nullable;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.function.Supplier;
/**
* OptionalUtils
* The optional utils class.
* @author Cyan ([email protected])
* @see lombok.extern.slf4j.Slf4j
* @since Jdk1.8
*/
@Slf4j
public final class OptionalUtils {
/**
* xOfNull
* The x of null method.
* @param {@link java.lang.Object} The parameter can be of any type.
* @param {@link java.lang.Throwable} The generic parameter is Throwable
type.
* @param object T The object parameter is T
type.
* @param supplier {@link java.util.function.Supplier} The supplier parameter is Supplier
type.
* @return X The x of null return object is X
type.
* @see java.lang.Throwable
* @see org.springframework.lang.Nullable
* @see java.util.function.Supplier
* @see org.springframework.lang.NonNull
*/
public static X xOfNull(@Nullable T object, @NonNull Supplier supplier) {
Objects.requireNonNull(supplier);
X cause = null;
if (GeneralUtils.isNull(object)) {
cause = supplier.get();
} else if (object instanceof Optional) {
Optional> optional = (Optional>) object;
if (optional.isPresent()) {
cause = supplier.get();
}
} else if (object instanceof RestOptional) {
RestOptional> optional = (RestOptional>) object;
if (optional.isNullPresent()) {
cause = supplier.get();
}
}
return cause;
}
/**
* xOfNullActuator
* The x of null actuator method.
* @param {@link java.lang.Object} The parameter can be of any type.
* @param {@link java.lang.Throwable} The generic parameter is Throwable
type.
* @param object T The object parameter is T
type.
* @param actuator {@link io.github.nichetoolkit.rest.actuator.SupplierActuator} The actuator parameter is SupplierActuator
type.
* @return X The x of null actuator return object is X
type.
* @throws RestException {@link io.github.nichetoolkit.rest.RestException} The rest exception is RestException
type.
* @see java.lang.Throwable
* @see org.springframework.lang.Nullable
* @see io.github.nichetoolkit.rest.actuator.SupplierActuator
* @see org.springframework.lang.NonNull
* @see io.github.nichetoolkit.rest.RestException
*/
public static X xOfNullActuator(@Nullable T object, @NonNull SupplierActuator actuator) throws RestException {
Objects.requireNonNull(actuator);
X cause = null;
if (GeneralUtils.isNull(object)) {
cause = actuator.actuate();
} else if (object instanceof Optional) {
Optional> optional = (Optional>) object;
if (!optional.isPresent()) {
cause = actuator.actuate();
}
} else if (object instanceof RestOptional) {
RestOptional> optional = (RestOptional>) object;
if (optional.isNull()) {
cause = actuator.actuate();
}
}
return cause;
}
/**
* xOfNull
* The x of null method.
* @param {@link java.lang.Object} The parameter can be of any type.
* @param {@link java.lang.Throwable} The generic parameter is Throwable
type.
* @param object T The object parameter is T
type.
* @param message {@link java.lang.String} The message parameter is String
type.
* @param function {@link java.util.function.Function} The function parameter is Function
type.
* @return X The x of null return object is X
type.
* @see java.lang.Throwable
* @see org.springframework.lang.Nullable
* @see java.lang.String
* @see java.util.function.Function
* @see org.springframework.lang.NonNull
*/
public static X xOfNull(@Nullable T object, String message, @NonNull Function function) {
Objects.requireNonNull(function);
X cause = null;
if (GeneralUtils.isNull(object)) {
cause = function.apply(message);
} else if (object instanceof Optional) {
Optional> optional = (Optional>) object;
if (!optional.isPresent()) {
cause = function.apply(message);
}
} else if (object instanceof RestOptional) {
RestOptional> optional = (RestOptional>) object;
if (optional.isNull()) {
cause = function.apply(message);
}
}
return cause;
}
/**
* xOfNullActuator
* The x of null actuator method.
* @param {@link java.lang.Object} The parameter can be of any type.
* @param {@link java.lang.Throwable} The generic parameter is Throwable
type.
* @param object T The object parameter is T
type.
* @param message {@link java.lang.String} The message parameter is String
type.
* @param actuator {@link io.github.nichetoolkit.rest.actuator.FunctionActuator} The actuator parameter is FunctionActuator
type.
* @return X The x of null actuator return object is X
type.
* @throws RestException {@link io.github.nichetoolkit.rest.RestException} The rest exception is RestException
type.
* @see java.lang.Throwable
* @see org.springframework.lang.Nullable
* @see java.lang.String
* @see io.github.nichetoolkit.rest.actuator.FunctionActuator
* @see org.springframework.lang.NonNull
* @see io.github.nichetoolkit.rest.RestException
*/
public static X xOfNullActuator(@Nullable T object, String message, @NonNull FunctionActuator actuator) throws RestException {
Objects.requireNonNull(actuator);
X cause = null;
if (GeneralUtils.isNull(object)) {
cause = actuator.actuate(message);
} else if (object instanceof Optional) {
Optional> optional = (Optional>) object;
if (!optional.isPresent()) {
cause = actuator.actuate(message);
}
} else if (object instanceof RestOptional) {
RestOptional> optional = (RestOptional>) object;
if (optional.isNull()) {
cause = actuator.actuate(message);
}
}
return cause;
}
/**
* xOfNull
* The x of null method.
* @param {@link java.lang.Object} The parameter can be of any type.
* @param {@link java.lang.Throwable} The generic parameter is Throwable
type.
* @param object T The object parameter is T
type.
* @param message {@link java.lang.String} The message parameter is String
type.
* @param resource {@link java.lang.String} The resource parameter is String
type.
* @param function {@link java.util.function.BiFunction} The function parameter is BiFunction
type.
* @return X The x of null return object is X
type.
* @see java.lang.Throwable
* @see org.springframework.lang.Nullable
* @see java.lang.String
* @see java.util.function.BiFunction
* @see org.springframework.lang.NonNull
*/
public static X xOfNull(@Nullable T object, String message, String resource, @NonNull BiFunction function) {
Objects.requireNonNull(function);
X cause = null;
if (GeneralUtils.isNull(object)) {
cause = function.apply(resource, message);
} else if (object instanceof Optional) {
Optional> optional = (Optional>) object;
if (!optional.isPresent()) {
cause = function.apply(resource, message);
}
} else if (object instanceof RestOptional) {
RestOptional> optional = (RestOptional>) object;
if (optional.isNull()) {
cause = function.apply(resource, message);
}
}
return cause;
}
/**
* xOfNullActuator
* The x of null actuator method.
* @param {@link java.lang.Object} The parameter can be of any type.
* @param {@link java.lang.Throwable} The generic parameter is Throwable
type.
* @param object T The object parameter is T
type.
* @param message {@link java.lang.String} The message parameter is String
type.
* @param resource {@link java.lang.String} The resource parameter is String
type.
* @param actuator {@link io.github.nichetoolkit.rest.actuator.BiFunctionActuator} The actuator parameter is BiFunctionActuator
type.
* @return X The x of null actuator return object is X
type.
* @throws RestException {@link io.github.nichetoolkit.rest.RestException} The rest exception is RestException
type.
* @see java.lang.Throwable
* @see org.springframework.lang.Nullable
* @see java.lang.String
* @see io.github.nichetoolkit.rest.actuator.BiFunctionActuator
* @see org.springframework.lang.NonNull
* @see io.github.nichetoolkit.rest.RestException
*/
public static X xOfNullActuator(@Nullable T object, String message, String resource, @NonNull BiFunctionActuator actuator) throws RestException {
Objects.requireNonNull(actuator);
X cause = null;
if (GeneralUtils.isNull(object)) {
cause = actuator.actuate(resource, message);
} else if (object instanceof Optional) {
Optional> optional = (Optional>) object;
if (!optional.isPresent()) {
cause = actuator.actuate(resource, message);
}
} else if (object instanceof RestOptional) {
RestOptional> optional = (RestOptional>) object;
if (optional.isNull()) {
cause = actuator.actuate(resource, message);
}
}
return cause;
}
/**
* xOfEmpty
* The x of empty method.
* @param {@link java.lang.Object} The parameter can be of any type.
* @param {@link java.lang.Throwable} The generic parameter is Throwable
type.
* @param object T The object parameter is T
type.
* @param supplier {@link java.util.function.Supplier} The supplier parameter is Supplier
type.
* @return X The x of empty return object is X
type.
* @see java.lang.Throwable
* @see org.springframework.lang.Nullable
* @see java.util.function.Supplier
* @see org.springframework.lang.NonNull
*/
public static X xOfEmpty(@Nullable T object, @NonNull Supplier supplier) {
Objects.requireNonNull(supplier);
X cause = null;
if (GeneralUtils.isEmpty(object)) {
cause = supplier.get();
} else if (object instanceof RestOptional) {
RestOptional> optional = (RestOptional>) object;
if (optional.isEmpty()) {
cause = supplier.get();
}
}
return cause;
}
/**
* xOfEmptyActuator
* The x of empty actuator method.
* @param {@link java.lang.Object} The parameter can be of any type.
* @param {@link java.lang.Throwable} The generic parameter is Throwable
type.
* @param object T The object parameter is T
type.
* @param actuator {@link io.github.nichetoolkit.rest.actuator.SupplierActuator} The actuator parameter is SupplierActuator
type.
* @return X The x of empty actuator return object is X
type.
* @throws RestException {@link io.github.nichetoolkit.rest.RestException} The rest exception is RestException
type.
* @see java.lang.Throwable
* @see org.springframework.lang.Nullable
* @see io.github.nichetoolkit.rest.actuator.SupplierActuator
* @see org.springframework.lang.NonNull
* @see io.github.nichetoolkit.rest.RestException
*/
public static X xOfEmptyActuator(@Nullable T object, @NonNull SupplierActuator actuator) throws RestException {
Objects.requireNonNull(actuator);
X cause = null;
if (GeneralUtils.isEmpty(object)) {
cause = actuator.actuate();
} else if (object instanceof RestOptional) {
RestOptional> optional = (RestOptional>) object;
if (optional.isEmpty()) {
cause = actuator.actuate();
}
}
return cause;
}
/**
* xOfEmpty
* The x of empty method.
* @param {@link java.lang.Object} The parameter can be of any type.
* @param {@link java.lang.Throwable} The generic parameter is Throwable
type.
* @param object T The object parameter is T
type.
* @param message {@link java.lang.String} The message parameter is String
type.
* @param function {@link java.util.function.Function} The function parameter is Function
type.
* @return X The x of empty return object is X
type.
* @see java.lang.Throwable
* @see org.springframework.lang.Nullable
* @see java.lang.String
* @see java.util.function.Function
* @see org.springframework.lang.NonNull
*/
public static X xOfEmpty(@Nullable T object, String message, @NonNull Function function) {
Objects.requireNonNull(function);
X cause = null;
if (GeneralUtils.isEmpty(object)) {
cause = function.apply(message);
} else if (object instanceof RestOptional) {
RestOptional> optional = (RestOptional>) object;
if (optional.isEmpty()) {
cause = function.apply(message);
}
}
return cause;
}
/**
* xOfEmptyActuator
* The x of empty actuator method.
* @param {@link java.lang.Object} The parameter can be of any type.
* @param {@link java.lang.Throwable} The generic parameter is Throwable
type.
* @param object T The object parameter is T
type.
* @param message {@link java.lang.String} The message parameter is String
type.
* @param actuator {@link io.github.nichetoolkit.rest.actuator.FunctionActuator} The actuator parameter is FunctionActuator
type.
* @return X The x of empty actuator return object is X
type.
* @throws RestException {@link io.github.nichetoolkit.rest.RestException} The rest exception is RestException
type.
* @see java.lang.Throwable
* @see org.springframework.lang.Nullable
* @see java.lang.String
* @see io.github.nichetoolkit.rest.actuator.FunctionActuator
* @see org.springframework.lang.NonNull
* @see io.github.nichetoolkit.rest.RestException
*/
public static X xOfEmptyActuator(@Nullable T object, String message, @NonNull FunctionActuator actuator) throws RestException {
Objects.requireNonNull(actuator);
X cause = null;
if (GeneralUtils.isEmpty(object)) {
cause = actuator.actuate(message);
} else if (object instanceof RestOptional) {
RestOptional> optional = (RestOptional>) object;
if (optional.isEmpty()) {
cause = actuator.actuate(message);
}
}
return cause;
}
/**
* xOfEmpty
* The x of empty method.
* @param {@link java.lang.Object} The parameter can be of any type.
* @param {@link java.lang.Throwable} The generic parameter is Throwable
type.
* @param object T The object parameter is T
type.
* @param message {@link java.lang.String} The message parameter is String
type.
* @param resource {@link java.lang.String} The resource parameter is String
type.
* @param function {@link java.util.function.BiFunction} The function parameter is BiFunction
type.
* @return X The x of empty return object is X
type.
* @see java.lang.Throwable
* @see org.springframework.lang.Nullable
* @see java.lang.String
* @see java.util.function.BiFunction
* @see org.springframework.lang.NonNull
*/
public static X xOfEmpty(@Nullable T object, String message, String resource, @NonNull BiFunction function) {
Objects.requireNonNull(function);
X cause = null;
if (GeneralUtils.isEmpty(object)) {
cause = function.apply(resource, message);
} else if (object instanceof RestOptional) {
RestOptional> optional = (RestOptional>) object;
if (optional.isEmpty()) {
cause = function.apply(resource, message);
}
}
return cause;
}
/**
* xOfEmptyActuator
* The x of empty actuator method.
* @param {@link java.lang.Object} The parameter can be of any type.
* @param {@link java.lang.Throwable} The generic parameter is Throwable
type.
* @param object T The object parameter is T
type.
* @param message {@link java.lang.String} The message parameter is String
type.
* @param resource {@link java.lang.String} The resource parameter is String
type.
* @param actuator {@link io.github.nichetoolkit.rest.actuator.BiFunctionActuator} The actuator parameter is BiFunctionActuator
type.
* @return X The x of empty actuator return object is X
type.
* @throws RestException {@link io.github.nichetoolkit.rest.RestException} The rest exception is RestException
type.
* @see java.lang.Throwable
* @see org.springframework.lang.Nullable
* @see java.lang.String
* @see io.github.nichetoolkit.rest.actuator.BiFunctionActuator
* @see org.springframework.lang.NonNull
* @see io.github.nichetoolkit.rest.RestException
*/
public static X xOfEmptyActuator(@Nullable T object, String message, String resource, @NonNull BiFunctionActuator actuator) throws RestException {
Objects.requireNonNull(actuator);
X cause = null;
if (GeneralUtils.isEmpty(object)) {
cause = actuator.actuate(resource, message);
} else if (object instanceof RestOptional) {
RestOptional> optional = (RestOptional>) object;
if (optional.isEmpty()) {
cause = actuator.actuate(resource, message);
}
}
return cause;
}
/**
* xOfInvalid
* The x of invalid method.
* @param {@link java.lang.Object} The parameter can be of any type.
* @param {@link java.lang.Throwable} The generic parameter is Throwable
type.
* @param object T The object parameter is T
type.
* @param supplier {@link java.util.function.Supplier} The supplier parameter is Supplier
type.
* @return X The x of invalid return object is X
type.
* @see java.lang.Throwable
* @see org.springframework.lang.Nullable
* @see java.util.function.Supplier
* @see org.springframework.lang.NonNull
*/
public static X xOfInvalid(@Nullable T object, @NonNull Supplier supplier) {
Objects.requireNonNull(supplier);
X cause = null;
if (GeneralUtils.isInvalid(object)) {
cause = supplier.get();
} else if (object instanceof RestOptional) {
RestOptional> optional = (RestOptional>) object;
if (optional.isInvalid()) {
cause = supplier.get();
}
}
return cause;
}
/**
* xOfInvalidActuator
* The x of invalid actuator method.
* @param {@link java.lang.Object} The parameter can be of any type.
* @param {@link java.lang.Throwable} The generic parameter is Throwable
type.
* @param object T The object parameter is T
type.
* @param actuator {@link io.github.nichetoolkit.rest.actuator.SupplierActuator} The actuator parameter is SupplierActuator
type.
* @return X The x of invalid actuator return object is X
type.
* @throws RestException {@link io.github.nichetoolkit.rest.RestException} The rest exception is RestException
type.
* @see java.lang.Throwable
* @see org.springframework.lang.Nullable
* @see io.github.nichetoolkit.rest.actuator.SupplierActuator
* @see org.springframework.lang.NonNull
* @see io.github.nichetoolkit.rest.RestException
*/
public static X xOfInvalidActuator(@Nullable T object, @NonNull SupplierActuator actuator) throws RestException {
Objects.requireNonNull(actuator);
X cause = null;
if (GeneralUtils.isInvalid(object)) {
cause = actuator.actuate();
} else if (object instanceof RestOptional) {
RestOptional> optional = (RestOptional>) object;
if (optional.isInvalid()) {
cause = actuator.actuate();
}
}
return cause;
}
/**
* xOfInvalid
* The x of invalid method.
* @param {@link java.lang.Object} The parameter can be of any type.
* @param {@link java.lang.Throwable} The generic parameter is Throwable
type.
* @param object T The object parameter is T
type.
* @param message {@link java.lang.String} The message parameter is String
type.
* @param function {@link java.util.function.Function} The function parameter is Function
type.
* @return X The x of invalid return object is X
type.
* @see java.lang.Throwable
* @see org.springframework.lang.Nullable
* @see java.lang.String
* @see java.util.function.Function
* @see org.springframework.lang.NonNull
*/
public static X xOfInvalid(@Nullable T object, String message, @NonNull Function function) {
Objects.requireNonNull(function);
X cause = null;
if (GeneralUtils.isInvalid(object)) {
cause = function.apply(message);
} else if (object instanceof RestOptional) {
RestOptional> optional = (RestOptional>) object;
if (optional.isInvalid()) {
cause = function.apply(message);
}
}
return cause;
}
/**
* xOfInvalidActuator
* The x of invalid actuator method.
* @param {@link java.lang.Object} The parameter can be of any type.
* @param {@link java.lang.Throwable} The generic parameter is Throwable
type.
* @param object T The object parameter is T
type.
* @param message {@link java.lang.String} The message parameter is String
type.
* @param actuator {@link io.github.nichetoolkit.rest.actuator.FunctionActuator} The actuator parameter is FunctionActuator
type.
* @return X The x of invalid actuator return object is X
type.
* @throws RestException {@link io.github.nichetoolkit.rest.RestException} The rest exception is RestException
type.
* @see java.lang.Throwable
* @see org.springframework.lang.Nullable
* @see java.lang.String
* @see io.github.nichetoolkit.rest.actuator.FunctionActuator
* @see org.springframework.lang.NonNull
* @see io.github.nichetoolkit.rest.RestException
*/
public static X xOfInvalidActuator(@Nullable T object, String message, @NonNull FunctionActuator actuator) throws RestException {
Objects.requireNonNull(actuator);
X cause = null;
if (GeneralUtils.isInvalid(object)) {
cause = actuator.actuate(message);
} else if (object instanceof RestOptional) {
RestOptional> optional = (RestOptional>) object;
if (optional.isInvalid()) {
cause = actuator.actuate(message);
}
}
return cause;
}
/**
* xOfInvalid
* The x of invalid method.
* @param {@link java.lang.Object} The parameter can be of any type.
* @param {@link java.lang.Throwable} The generic parameter is Throwable
type.
* @param object T The object parameter is T
type.
* @param message {@link java.lang.String} The message parameter is String
type.
* @param resource {@link java.lang.String} The resource parameter is String
type.
* @param function {@link java.util.function.BiFunction} The function parameter is BiFunction
type.
* @return X The x of invalid return object is X
type.
* @see java.lang.Throwable
* @see org.springframework.lang.Nullable
* @see java.lang.String
* @see java.util.function.BiFunction
* @see org.springframework.lang.NonNull
*/
public static X xOfInvalid(@Nullable T object, String message, String resource, @NonNull BiFunction function) {
Objects.requireNonNull(function);
X cause = null;
if (GeneralUtils.isInvalid(object)) {
cause = function.apply(resource, message);
} else if (object instanceof RestOptional) {
RestOptional> optional = (RestOptional>) object;
if (optional.isInvalid()) {
cause = function.apply(resource, message);
}
}
return cause;
}
/**
* xOfInvalidActuator
* The x of invalid actuator method.
* @param {@link java.lang.Object} The parameter can be of any type.
* @param {@link io.github.nichetoolkit.rest.RestException} The generic parameter is RestException
type.
* @param object T The object parameter is T
type.
* @param message {@link java.lang.String} The message parameter is String
type.
* @param resource {@link java.lang.String} The resource parameter is String
type.
* @param actuator {@link io.github.nichetoolkit.rest.actuator.BiFunctionActuator} The actuator parameter is BiFunctionActuator
type.
* @return X The x of invalid actuator return object is X
type.
* @throws RestException {@link io.github.nichetoolkit.rest.RestException} The rest exception is RestException
type.
* @see io.github.nichetoolkit.rest.RestException
* @see org.springframework.lang.Nullable
* @see java.lang.String
* @see io.github.nichetoolkit.rest.actuator.BiFunctionActuator
* @see org.springframework.lang.NonNull
*/
public static X xOfInvalidActuator(@Nullable T object, String message, String resource, @NonNull BiFunctionActuator actuator) throws RestException {
Objects.requireNonNull(actuator);
X cause = null;
if (GeneralUtils.isInvalid(object)) {
cause = actuator.actuate(resource, message);
} else if (object instanceof RestOptional) {
RestOptional> optional = (RestOptional>) object;
if (optional.isInvalid()) {
cause = actuator.actuate(resource, message);
}
}
return cause;
}
/**
* ofCauseThrow
* The of cause throw method.
* @param {@link java.lang.Throwable} The generic parameter is Throwable
type.
* @param cause X The cause parameter is X
type.
* @throws X X The x is X
type.
* @see java.lang.Throwable
*/
public static void ofCauseThrow(X cause) throws X {
if (GeneralUtils.isNotNull(cause)) {
log.error(cause.getMessage());
throw cause;
}
}
/**
* ofCauseThrow
* The of cause throw method.
* @param {@link java.lang.Throwable} The generic parameter is Throwable
type.
* @param log {@link org.slf4j.Logger} The log parameter is Logger
type.
* @param cause X The cause parameter is X
type.
* @throws X X The x is X
type.
* @see java.lang.Throwable
* @see org.slf4j.Logger
*/
public static void ofCauseThrow(Logger log, X cause) throws X {
if (GeneralUtils.isNotNull(cause)) {
log.error(cause.getMessage());
throw cause;
}
}
/**
* ofCauseThrowError
* The of cause throw error method.
* @param {@link io.github.nichetoolkit.rest.RestError} The generic parameter is RestError
type.
* @param cause X The cause parameter is X
type.
* @see io.github.nichetoolkit.rest.RestError
*/
public static void ofCauseThrowError(X cause) {
if (GeneralUtils.isNotNull(cause)) {
log.error(cause.getMessage());
throw cause;
}
}
/**
* ofCauseThrowError
* The of cause throw error method.
* @param {@link io.github.nichetoolkit.rest.RestError} The generic parameter is RestError
type.
* @param log {@link org.slf4j.Logger} The log parameter is Logger
type.
* @param cause X The cause parameter is X
type.
* @see io.github.nichetoolkit.rest.RestError
* @see org.slf4j.Logger
*/
public static void ofCauseThrowError(Logger log, X cause) {
if (GeneralUtils.isNotNull(cause)) {
log.error(cause.getMessage());
throw cause;
}
}
/**
* ofCauseThrowException
* The of cause throw exception method.
* @param {@link io.github.nichetoolkit.rest.RestException} The generic parameter is RestException
type.
* @param cause {@link io.github.nichetoolkit.rest.RestException} The cause parameter is RestException
type.
* @throws RestException {@link io.github.nichetoolkit.rest.RestException} The rest exception is RestException
type.
* @see io.github.nichetoolkit.rest.RestException
*/
public static void ofCauseThrowException(RestException cause) throws RestException {
if (GeneralUtils.isNotNull(cause)) {
log.error(cause.getMessage());
throw cause;
}
}
/**
* ofCauseThrowException
* The of cause throw exception method.
* @param {@link io.github.nichetoolkit.rest.RestException} The generic parameter is RestException
type.
* @param log {@link org.slf4j.Logger} The log parameter is Logger
type.
* @param cause {@link io.github.nichetoolkit.rest.RestException} The cause parameter is RestException
type.
* @throws RestException {@link io.github.nichetoolkit.rest.RestException} The rest exception is RestException
type.
* @see io.github.nichetoolkit.rest.RestException
* @see org.slf4j.Logger
*/
public static void ofCauseThrowException(Logger log, RestException cause) throws RestException {
if (GeneralUtils.isNotNull(cause)) {
log.error(cause.getMessage());
throw cause;
}
}
/**
* ofTrueThrow
* The of true throw method.
* @param {@link java.lang.Throwable} The generic parameter is Throwable
type.
* @param present {@link java.lang.Boolean} The present parameter is Boolean
type.
* @param supplier {@link java.util.function.Supplier} The supplier parameter is Supplier
type.
* @throws X X The x is X
type.
* @see java.lang.Throwable
* @see java.lang.Boolean
* @see java.util.function.Supplier
* @see X
*/
public static void ofTrueThrow(Boolean present, Supplier supplier) throws X {
if (GeneralUtils.isNotNull(present) && present) {
X cause = supplier.get();
log.error(cause.getMessage());
throw cause;
}
}
/**
* ofTrueThrow
* The of true throw method.
* @param {@link java.lang.Throwable} The generic parameter is Throwable
type.
* @param present {@link java.lang.Boolean} The present parameter is Boolean
type.
* @param log {@link org.slf4j.Logger} The log parameter is Logger
type.
* @param supplier {@link java.util.function.Supplier} The supplier parameter is Supplier
type.
* @throws X X The x is X
type.
* @see java.lang.Throwable
* @see java.lang.Boolean
* @see org.slf4j.Logger
* @see java.util.function.Supplier
* @see X
*/
public static void ofTrueThrow(Boolean present, Logger log, Supplier supplier) throws X {
if (GeneralUtils.isNotNull(present) && present) {
X cause = supplier.get();
log.error(cause.getMessage());
throw cause;
}
}
/**
* ofTrueThrowError
* The of true throw error method.
* @param {@link io.github.nichetoolkit.rest.RestError} The generic parameter is RestError
type.
* @param present {@link java.lang.Boolean} The present parameter is Boolean
type.
* @param supplier {@link java.util.function.Supplier} The supplier parameter is Supplier
type.
* @see io.github.nichetoolkit.rest.RestError
* @see java.lang.Boolean
* @see java.util.function.Supplier
*/
public static void ofTrueThrowError(Boolean present, Supplier supplier) {
if (GeneralUtils.isNotNull(present) && present) {
X cause = supplier.get();
log.error(cause.getMessage());
throw cause;
}
}
/**
* ofTrueThrowError
* The of true throw error method.
* @param {@link io.github.nichetoolkit.rest.RestError} The generic parameter is RestError
type.
* @param present {@link java.lang.Boolean} The present parameter is Boolean
type.
* @param log {@link org.slf4j.Logger} The log parameter is Logger
type.
* @param supplier {@link java.util.function.Supplier} The supplier parameter is Supplier
type.
* @see io.github.nichetoolkit.rest.RestError
* @see java.lang.Boolean
* @see org.slf4j.Logger
* @see java.util.function.Supplier
*/
public static void ofTrueThrowError(Boolean present, Logger log, Supplier supplier) {
if (GeneralUtils.isNotNull(present) && present) {
X cause = supplier.get();
log.error(cause.getMessage());
throw cause;
}
}
/**
* ofTrueThrowException
* The of true throw exception method.
* @param {@link io.github.nichetoolkit.rest.RestException} The generic parameter is RestException
type.
* @param present {@link java.lang.Boolean} The present parameter is Boolean
type.
* @param actuator {@link io.github.nichetoolkit.rest.actuator.SupplierActuator} The actuator parameter is SupplierActuator
type.
* @throws RestException {@link io.github.nichetoolkit.rest.RestException} The rest exception is RestException
type.
* @see io.github.nichetoolkit.rest.RestException
* @see java.lang.Boolean
* @see io.github.nichetoolkit.rest.actuator.SupplierActuator
*/
public static void ofTrueThrowException(Boolean present, SupplierActuator actuator) throws RestException {
if (GeneralUtils.isNotNull(present) && present) {
X cause = actuator.actuate();
log.error(cause.getMessage());
throw cause;
}
}
/**
* ofTrueThrowException
* The of true throw exception method.
* @param {@link io.github.nichetoolkit.rest.RestException} The generic parameter is RestException
type.
* @param present {@link java.lang.Boolean} The present parameter is Boolean
type.
* @param log {@link org.slf4j.Logger} The log parameter is Logger
type.
* @param actuator {@link io.github.nichetoolkit.rest.actuator.SupplierActuator} The actuator parameter is SupplierActuator
type.
* @throws RestException {@link io.github.nichetoolkit.rest.RestException} The rest exception is RestException
type.
* @see io.github.nichetoolkit.rest.RestException
* @see java.lang.Boolean
* @see org.slf4j.Logger
* @see io.github.nichetoolkit.rest.actuator.SupplierActuator
*/
public static void ofTrueThrowException(Boolean present, Logger log, SupplierActuator actuator) throws RestException {
if (GeneralUtils.isNotNull(present) && present) {
X cause = actuator.actuate();
log.error(cause.getMessage());
throw cause;
}
}
/**
* ofTrueThrow
* The of true throw method.
* @param {@link java.lang.Throwable} The generic parameter is Throwable
type.
* @param present {@link java.lang.Boolean} The present parameter is Boolean
type.
* @param message {@link java.lang.String} The message parameter is String
type.
* @param function {@link java.util.function.Function} The function parameter is Function
type.
* @throws X X The x is X
type.
* @see java.lang.Throwable
* @see java.lang.Boolean
* @see java.lang.String
* @see java.util.function.Function
* @see X
*/
public static void ofTrueThrow(Boolean present, String message, Function function) throws X {
if (GeneralUtils.isNotNull(present) && present) {
X cause = function.apply(message);
log.error(cause.getMessage());
throw cause;
}
}
/**
* ofTrueThrow
* The of true throw method.
* @param {@link java.lang.Throwable} The generic parameter is Throwable
type.
* @param present {@link java.lang.Boolean} The present parameter is Boolean
type.
* @param message {@link java.lang.String} The message parameter is String
type.
* @param log {@link org.slf4j.Logger} The log parameter is Logger
type.
* @param function {@link java.util.function.Function} The function parameter is Function
type.
* @throws X X The x is X
type.
* @see java.lang.Throwable
* @see java.lang.Boolean
* @see java.lang.String
* @see org.slf4j.Logger
* @see java.util.function.Function
* @see X
*/
public static void ofTrueThrow(Boolean present, String message, Logger log, Function function) throws X {
if (GeneralUtils.isNotNull(present) && present) {
X cause = function.apply(message);
log.error(cause.getMessage());
throw cause;
}
}
/**
* ofTrueThrowError
* The of true throw error method.
* @param {@link io.github.nichetoolkit.rest.RestError} The generic parameter is RestError
type.
* @param present {@link java.lang.Boolean} The present parameter is Boolean
type.
* @param message {@link java.lang.String} The message parameter is String
type.
* @param function {@link java.util.function.Function} The function parameter is Function
type.
* @see io.github.nichetoolkit.rest.RestError
* @see java.lang.Boolean
* @see java.lang.String
* @see java.util.function.Function
*/
public static void ofTrueThrowError(Boolean present, String message, Function function) {
if (GeneralUtils.isNotNull(present) && present) {
X cause = function.apply(message);
log.error(cause.getMessage());
throw cause;
}
}
/**
* ofTrueThrowError
* The of true throw error method.
* @param {@link io.github.nichetoolkit.rest.RestError} The generic parameter is RestError
type.
* @param present {@link java.lang.Boolean} The present parameter is Boolean
type.
* @param message {@link java.lang.String} The message parameter is String
type.
* @param log {@link org.slf4j.Logger} The log parameter is Logger
type.
* @param function {@link java.util.function.Function} The function parameter is Function
type.
* @see io.github.nichetoolkit.rest.RestError
* @see java.lang.Boolean
* @see java.lang.String
* @see org.slf4j.Logger
* @see java.util.function.Function
*/
public static void ofTrueThrowError(Boolean present, String message, Logger log, Function function) {
if (GeneralUtils.isNotNull(present) && present) {
X cause = function.apply(message);
log.error(cause.getMessage());
throw cause;
}
}
/**
* ofTrueThrowException
* The of true throw exception method.
* @param {@link io.github.nichetoolkit.rest.RestException} The generic parameter is RestException
type.
* @param present {@link java.lang.Boolean} The present parameter is Boolean
type.
* @param message {@link java.lang.String} The message parameter is String
type.
* @param actuator {@link io.github.nichetoolkit.rest.actuator.FunctionActuator} The actuator parameter is FunctionActuator
type.
* @throws RestException {@link io.github.nichetoolkit.rest.RestException} The rest exception is RestException
type.
* @see io.github.nichetoolkit.rest.RestException
* @see java.lang.Boolean
* @see java.lang.String
* @see io.github.nichetoolkit.rest.actuator.FunctionActuator
*/
public static void ofTrueThrowException(Boolean present, String message, FunctionActuator actuator) throws RestException {
if (GeneralUtils.isNotNull(present) && present) {
X cause = actuator.actuate(message);
log.error(cause.getMessage());
throw cause;
}
}
/**
* ofTrueThrowException
* The of true throw exception method.
* @param {@link io.github.nichetoolkit.rest.RestException} The generic parameter is RestException
type.
* @param present {@link java.lang.Boolean} The present parameter is Boolean
type.
* @param message {@link java.lang.String} The message parameter is String
type.
* @param log {@link org.slf4j.Logger} The log parameter is Logger
type.
* @param actuator {@link io.github.nichetoolkit.rest.actuator.FunctionActuator} The actuator parameter is FunctionActuator
type.
* @throws RestException {@link io.github.nichetoolkit.rest.RestException} The rest exception is RestException
type.
* @see io.github.nichetoolkit.rest.RestException
* @see java.lang.Boolean
* @see java.lang.String
* @see org.slf4j.Logger
* @see io.github.nichetoolkit.rest.actuator.FunctionActuator
*/
public static void ofTrueThrowException(Boolean present, String message, Logger log, FunctionActuator actuator) throws RestException {
if (GeneralUtils.isNotNull(present) && present) {
X cause = actuator.actuate(message);
log.error(cause.getMessage());
throw cause;
}
}
/**
* ofTrueThrow
* The of true throw method.
* @param {@link java.lang.Throwable} The generic parameter is Throwable
type.
* @param present {@link java.lang.Boolean} The present parameter is Boolean
type.
* @param message {@link java.lang.String} The message parameter is String
type.
* @param resource {@link java.lang.String} The resource parameter is String
type.
* @param function {@link java.util.function.BiFunction} The function parameter is BiFunction
type.
* @throws X X The x is X
type.
* @see java.lang.Throwable
* @see java.lang.Boolean
* @see java.lang.String
* @see java.util.function.BiFunction
* @see X
*/
public static void ofTrueThrow(Boolean present, String message, String resource, BiFunction function) throws X {
if (GeneralUtils.isNotNull(present) && present) {
X cause = function.apply(resource, message);
log.error(cause.getMessage());
throw cause;
}
}
/**
* ofTrueThrow
* The of true throw method.
* @param {@link java.lang.Throwable} The generic parameter is Throwable
type.
* @param present {@link java.lang.Boolean} The present parameter is Boolean
type.
* @param message {@link java.lang.String} The message parameter is String
type.
* @param resource {@link java.lang.String} The resource parameter is String
type.
* @param log {@link org.slf4j.Logger} The log parameter is Logger
type.
* @param function {@link java.util.function.BiFunction} The function parameter is BiFunction
type.
* @throws X X The x is X
type.
* @see java.lang.Throwable
* @see java.lang.Boolean
* @see java.lang.String
* @see org.slf4j.Logger
* @see java.util.function.BiFunction
* @see X
*/
public static void ofTrueThrow(Boolean present, String message, String resource, Logger log, BiFunction function) throws X {
if (GeneralUtils.isNotNull(present) && present) {
X cause = function.apply(resource, message);
log.error(cause.getMessage());
throw cause;
}
}
/**
* ofTrueThrowError
* The of true throw error method.
* @param {@link io.github.nichetoolkit.rest.RestError} The generic parameter is RestError
type.
* @param present {@link java.lang.Boolean} The present parameter is Boolean
type.
* @param message {@link java.lang.String} The message parameter is String
type.
* @param resource {@link java.lang.String} The resource parameter is String
type.
* @param function {@link java.util.function.BiFunction} The function parameter is BiFunction
type.
* @see io.github.nichetoolkit.rest.RestError
* @see java.lang.Boolean
* @see java.lang.String
* @see java.util.function.BiFunction
*/
public static void ofTrueThrowError(Boolean present, String message, String resource, BiFunction function) {
if (GeneralUtils.isNotNull(present) && present) {
X cause = function.apply(resource, message);
log.error(cause.getMessage());
throw cause;
}
}
/**
* ofTrueThrowError
* The of true throw error method.
* @param {@link io.github.nichetoolkit.rest.RestError} The generic parameter is RestError
type.
* @param present {@link java.lang.Boolean} The present parameter is Boolean
type.
* @param message {@link java.lang.String} The message parameter is String
type.
* @param resource {@link java.lang.String} The resource parameter is String
type.
* @param log {@link org.slf4j.Logger} The log parameter is Logger
type.
* @param function {@link java.util.function.BiFunction} The function parameter is BiFunction
type.
* @see io.github.nichetoolkit.rest.RestError
* @see java.lang.Boolean
* @see java.lang.String
* @see org.slf4j.Logger
* @see java.util.function.BiFunction
*/
public static void ofTrueThrowError(Boolean present, String message, String resource, Logger log, BiFunction function) {
if (GeneralUtils.isNotNull(present) && present) {
X cause = function.apply(resource, message);
log.error(cause.getMessage());
throw cause;
}
}
/**
* ofTrueThrowException
* The of true throw exception method.
* @param {@link io.github.nichetoolkit.rest.RestException} The generic parameter is RestException
type.
* @param present {@link java.lang.Boolean} The present parameter is Boolean
type.
* @param message {@link java.lang.String} The message parameter is String
type.
* @param resource {@link java.lang.String} The resource parameter is String
type.
* @param actuator {@link io.github.nichetoolkit.rest.actuator.BiFunctionActuator} The actuator parameter is BiFunctionActuator
type.
* @throws RestException {@link io.github.nichetoolkit.rest.RestException} The rest exception is RestException
type.
* @see io.github.nichetoolkit.rest.RestException
* @see java.lang.Boolean
* @see java.lang.String
* @see io.github.nichetoolkit.rest.actuator.BiFunctionActuator
*/
public static void ofTrueThrowException(Boolean present, String message, String resource, BiFunctionActuator actuator) throws RestException {
if (GeneralUtils.isNotNull(present) && present) {
X cause = actuator.actuate(resource, message);
log.error(cause.getMessage());
throw cause;
}
}
/**
* ofTrueThrowException
* The of true throw exception method.
* @param {@link io.github.nichetoolkit.rest.RestException} The generic parameter is RestException
type.
* @param present {@link java.lang.Boolean} The present parameter is Boolean
type.
* @param message {@link java.lang.String} The message parameter is String
type.
* @param resource {@link java.lang.String} The resource parameter is String
type.
* @param log {@link org.slf4j.Logger} The log parameter is Logger
type.
* @param actuator {@link io.github.nichetoolkit.rest.actuator.BiFunctionActuator} The actuator parameter is BiFunctionActuator
type.
* @throws RestException {@link io.github.nichetoolkit.rest.RestException} The rest exception is RestException
type.
* @see io.github.nichetoolkit.rest.RestException
* @see java.lang.Boolean
* @see java.lang.String
* @see org.slf4j.Logger
* @see io.github.nichetoolkit.rest.actuator.BiFunctionActuator
*/
public static void ofTrueThrowException(Boolean present, String message, String resource, Logger log, BiFunctionActuator actuator) throws RestException {
if (GeneralUtils.isNotNull(present) && present) {
X cause = actuator.actuate(resource, message);
log.error(cause.getMessage());
throw cause;
}
}
/**
* ofFalseThrow
* The of false throw method.
* @param {@link java.lang.Throwable} The generic parameter is Throwable
type.
* @param present {@link java.lang.Boolean} The present parameter is Boolean
type.
* @param supplier {@link java.util.function.Supplier} The supplier parameter is Supplier
type.
* @throws X X The x is X
type.
* @see java.lang.Throwable
* @see java.lang.Boolean
* @see java.util.function.Supplier
* @see X
*/
public static void ofFalseThrow(Boolean present, Supplier supplier) throws X {
if (GeneralUtils.isNotNull(present) && !present) {
X cause = supplier.get();
log.error(cause.getMessage());
throw cause;
}
}
/**
* ofFalseThrow
* The of false throw method.
* @param {@link java.lang.Throwable} The generic parameter is Throwable
type.
* @param present {@link java.lang.Boolean} The present parameter is Boolean
type.
* @param log {@link org.slf4j.Logger} The log parameter is Logger
type.
* @param supplier {@link java.util.function.Supplier} The supplier parameter is Supplier
type.
* @throws X X The x is X
type.
* @see java.lang.Throwable
* @see java.lang.Boolean
* @see org.slf4j.Logger
* @see java.util.function.Supplier
* @see X
*/
public static void ofFalseThrow(Boolean present, Logger log, Supplier supplier) throws X {
if (GeneralUtils.isNotNull(present) && !present) {
X cause = supplier.get();
log.error(cause.getMessage());
throw cause;
}
}
/**
* ofFalseThrowError
* The of false throw error method.
* @param {@link io.github.nichetoolkit.rest.RestError} The generic parameter is RestError
type.
* @param present {@link java.lang.Boolean} The present parameter is Boolean
type.
* @param supplier {@link java.util.function.Supplier} The supplier parameter is Supplier
type.
* @see io.github.nichetoolkit.rest.RestError
* @see java.lang.Boolean
* @see java.util.function.Supplier
*/
public static void ofFalseThrowError(Boolean present, Supplier supplier) {
if (GeneralUtils.isNotNull(present) && !present) {
X cause = supplier.get();
log.error(cause.getMessage());
throw cause;
}
}
/**
* ofFalseThrowError
* The of false throw error method.
* @param {@link io.github.nichetoolkit.rest.RestError} The generic parameter is RestError
type.
* @param present {@link java.lang.Boolean} The present parameter is Boolean
type.
* @param log {@link org.slf4j.Logger} The log parameter is Logger
type.
* @param supplier {@link java.util.function.Supplier} The supplier parameter is Supplier
type.
* @see io.github.nichetoolkit.rest.RestError
* @see java.lang.Boolean
* @see org.slf4j.Logger
* @see java.util.function.Supplier
*/
public static void ofFalseThrowError(Boolean present, Logger log, Supplier supplier) {
if (GeneralUtils.isNotNull(present) && !present) {
X cause = supplier.get();
log.error(cause.getMessage());
throw cause;
}
}
/**
* ofFalseThrowException
* The of false throw exception method.
* @param {@link io.github.nichetoolkit.rest.RestException} The generic parameter is RestException
type.
* @param present {@link java.lang.Boolean} The present parameter is Boolean
type.
* @param actuator {@link io.github.nichetoolkit.rest.actuator.SupplierActuator} The actuator parameter is SupplierActuator
type.
* @throws RestException {@link io.github.nichetoolkit.rest.RestException} The rest exception is RestException
type.
* @see io.github.nichetoolkit.rest.RestException
* @see java.lang.Boolean
* @see io.github.nichetoolkit.rest.actuator.SupplierActuator
*/
public static void ofFalseThrowException(Boolean present, SupplierActuator actuator) throws RestException {
if (GeneralUtils.isNotNull(present) && !present) {
X cause = actuator.actuate();
log.error(cause.getMessage());
throw cause;
}
}
/**
* ofFalseThrowException
* The of false throw exception method.
* @param {@link io.github.nichetoolkit.rest.RestException} The generic parameter is RestException
type.
* @param present {@link java.lang.Boolean} The present parameter is Boolean
type.
* @param log {@link org.slf4j.Logger} The log parameter is Logger
type.
* @param actuator {@link io.github.nichetoolkit.rest.actuator.SupplierActuator} The actuator parameter is SupplierActuator
type.
* @throws RestException {@link io.github.nichetoolkit.rest.RestException} The rest exception is RestException
type.
* @see io.github.nichetoolkit.rest.RestException
* @see java.lang.Boolean
* @see org.slf4j.Logger
* @see io.github.nichetoolkit.rest.actuator.SupplierActuator
*/
public static void ofFalseThrowException(Boolean present, Logger log, SupplierActuator actuator) throws RestException {
if (GeneralUtils.isNotNull(present) && !present) {
X cause = actuator.actuate();
log.error(cause.getMessage());
throw cause;
}
}
/**
* ofFalseThrow
* The of false throw method.
* @param {@link java.lang.Throwable} The generic parameter is Throwable
type.
* @param present {@link java.lang.Boolean} The present parameter is Boolean
type.
* @param message {@link java.lang.String} The message parameter is String
type.
* @param function {@link java.util.function.Function} The function parameter is Function
type.
* @throws X X The x is X
type.
* @see java.lang.Throwable
* @see java.lang.Boolean
* @see java.lang.String
* @see java.util.function.Function
* @see X
*/
public static void ofFalseThrow(Boolean present, String message, Function function) throws X {
if (GeneralUtils.isNotNull(present) && !present) {
X cause = function.apply(message);
log.error(cause.getMessage());
throw cause;
}
}
/**
* ofFalseThrow
* The of false throw method.
* @param {@link java.lang.Throwable} The generic parameter is Throwable
type.
* @param present {@link java.lang.Boolean} The present parameter is Boolean
type.
* @param message {@link java.lang.String} The message parameter is String
type.
* @param log {@link org.slf4j.Logger} The log parameter is Logger
type.
* @param function {@link java.util.function.Function} The function parameter is Function
type.
* @throws X X The x is X
type.
* @see java.lang.Throwable
* @see java.lang.Boolean
* @see java.lang.String
* @see org.slf4j.Logger
* @see java.util.function.Function
* @see X
*/
public static void ofFalseThrow(Boolean present, String message, Logger log, Function function) throws X {
if (GeneralUtils.isNotNull(present) && !present) {
X cause = function.apply(message);
log.error(cause.getMessage());
throw cause;
}
}
/**
* ofFalseThrowError
* The of false throw error method.
* @param {@link io.github.nichetoolkit.rest.RestError} The generic parameter is RestError
type.
* @param present {@link java.lang.Boolean} The present parameter is Boolean
type.
* @param message {@link java.lang.String} The message parameter is String
type.
* @param function {@link java.util.function.Function} The function parameter is Function
type.
* @see io.github.nichetoolkit.rest.RestError
* @see java.lang.Boolean
* @see java.lang.String
* @see java.util.function.Function
*/
public static void ofFalseThrowError(Boolean present, String message, Function function) {
if (GeneralUtils.isNotNull(present) && !present) {
X cause = function.apply(message);
log.error(cause.getMessage());
throw cause;
}
}
/**
* ofFalseThrowError
* The of false throw error method.
* @param {@link io.github.nichetoolkit.rest.RestError} The generic parameter is RestError
type.
* @param present {@link java.lang.Boolean} The present parameter is Boolean
type.
* @param message {@link java.lang.String} The message parameter is String
type.
* @param log {@link org.slf4j.Logger} The log parameter is Logger
type.
* @param function {@link java.util.function.Function} The function parameter is Function
type.
* @see io.github.nichetoolkit.rest.RestError
* @see java.lang.Boolean
* @see java.lang.String
* @see org.slf4j.Logger
* @see java.util.function.Function
*/
public static void ofFalseThrowError(Boolean present, String message, Logger log, Function function) {
if (GeneralUtils.isNotNull(present) && !present) {
X cause = function.apply(message);
log.error(cause.getMessage());
throw cause;
}
}
/**
* ofFalseThrowException
* The of false throw exception method.
* @param {@link io.github.nichetoolkit.rest.RestException} The generic parameter is RestException
type.
* @param present {@link java.lang.Boolean} The present parameter is Boolean
type.
* @param message {@link java.lang.String} The message parameter is String
type.
* @param actuator {@link io.github.nichetoolkit.rest.actuator.FunctionActuator} The actuator parameter is FunctionActuator
type.
* @throws RestException {@link io.github.nichetoolkit.rest.RestException} The rest exception is RestException
type.
* @see io.github.nichetoolkit.rest.RestException
* @see java.lang.Boolean
* @see java.lang.String
* @see io.github.nichetoolkit.rest.actuator.FunctionActuator
*/
public static void ofFalseThrowException(Boolean present, String message, FunctionActuator actuator) throws RestException {
if (GeneralUtils.isNotNull(present) && !present) {
X cause = actuator.actuate(message);
log.error(cause.getMessage());
throw cause;
}
}
/**
* ofFalseThrowException
* The of false throw exception method.
* @param {@link io.github.nichetoolkit.rest.RestException} The generic parameter is RestException
type.
* @param present {@link java.lang.Boolean} The present parameter is Boolean
type.
* @param message {@link java.lang.String} The message parameter is String
type.
* @param log {@link org.slf4j.Logger} The log parameter is Logger
type.
* @param actuator {@link io.github.nichetoolkit.rest.actuator.FunctionActuator} The actuator parameter is FunctionActuator
type.
* @throws RestException {@link io.github.nichetoolkit.rest.RestException} The rest exception is RestException
type.
* @see io.github.nichetoolkit.rest.RestException
* @see java.lang.Boolean
* @see java.lang.String
* @see org.slf4j.Logger
* @see io.github.nichetoolkit.rest.actuator.FunctionActuator
*/
public static void ofFalseThrowException(Boolean present, String message, Logger log, FunctionActuator actuator) throws RestException {
if (GeneralUtils.isNotNull(present) && !present) {
X cause = actuator.actuate(message);
log.error(cause.getMessage());
throw cause;
}
}
/**
* ofFalseThrow
* The of false throw method.
* @param {@link java.lang.Throwable} The generic parameter is Throwable
type.
* @param present {@link java.lang.Boolean} The present parameter is Boolean
type.
* @param message {@link java.lang.String} The message parameter is String
type.
* @param resource {@link java.lang.String} The resource parameter is String
type.
* @param function {@link java.util.function.BiFunction} The function parameter is BiFunction
type.
* @throws X X The x is X
type.
* @see java.lang.Throwable
* @see java.lang.Boolean
* @see java.lang.String
* @see java.util.function.BiFunction
* @see X
*/
public static void ofFalseThrow(Boolean present, String message, String resource, BiFunction function) throws X {
if (GeneralUtils.isNotNull(present) && !present) {
X cause = function.apply(resource, message);
log.error(cause.getMessage());
throw cause;
}
}
/**
* ofFalseThrow
* The of false throw method.
* @param {@link java.lang.Throwable} The generic parameter is Throwable
type.
* @param present {@link java.lang.Boolean} The present parameter is Boolean
type.
* @param message {@link java.lang.String} The message parameter is String
type.
* @param resource {@link java.lang.String} The resource parameter is String
type.
* @param log {@link org.slf4j.Logger} The log parameter is Logger
type.
* @param function {@link java.util.function.BiFunction} The function parameter is BiFunction
type.
* @throws X X The x is X
type.
* @see java.lang.Throwable
* @see java.lang.Boolean
* @see java.lang.String
* @see org.slf4j.Logger
* @see java.util.function.BiFunction
* @see X
*/
public static void ofFalseThrow(Boolean present, String message, String resource, Logger log, BiFunction function) throws X {
if (GeneralUtils.isNotNull(present) && !present) {
X cause = function.apply(resource, message);
log.error(cause.getMessage());
throw cause;
}
}
/**
* ofFalseThrowError
* The of false throw error method.
* @param {@link io.github.nichetoolkit.rest.RestError} The generic parameter is RestError
type.
* @param present {@link java.lang.Boolean} The present parameter is Boolean
type.
* @param message {@link java.lang.String} The message parameter is String
type.
* @param resource {@link java.lang.String} The resource parameter is String
type.
* @param function {@link java.util.function.BiFunction} The function parameter is BiFunction
type.
* @see io.github.nichetoolkit.rest.RestError
* @see java.lang.Boolean
* @see java.lang.String
* @see java.util.function.BiFunction
*/
public static void ofFalseThrowError(Boolean present, String message, String resource, BiFunction function) {
if (GeneralUtils.isNotNull(present) && !present) {
X cause = function.apply(resource, message);
log.error(cause.getMessage());
throw cause;
}
}
/**
* ofFalseThrowError
* The of false throw error method.
* @param {@link io.github.nichetoolkit.rest.RestError} The generic parameter is RestError
type.
* @param present {@link java.lang.Boolean} The present parameter is Boolean
type.
* @param message {@link java.lang.String} The message parameter is String
type.
* @param resource {@link java.lang.String} The resource parameter is String
type.
* @param log {@link org.slf4j.Logger} The log parameter is Logger
type.
* @param function {@link java.util.function.BiFunction} The function parameter is BiFunction
type.
* @see io.github.nichetoolkit.rest.RestError
* @see java.lang.Boolean
* @see java.lang.String
* @see org.slf4j.Logger
* @see java.util.function.BiFunction
*/
public static void ofFalseThrowError(Boolean present, String message, String resource, Logger log, BiFunction function) {
if (GeneralUtils.isNotNull(present) && !present) {
X cause = function.apply(resource, message);
log.error(cause.getMessage());
throw cause;
}
}
/**
* ofFalseThrowException
* The of false throw exception method.
* @param {@link io.github.nichetoolkit.rest.RestException} The generic parameter is RestException
type.
* @param present {@link java.lang.Boolean} The present parameter is Boolean
type.
* @param message {@link java.lang.String} The message parameter is String
type.
* @param resource {@link java.lang.String} The resource parameter is String
type.
* @param actuator {@link io.github.nichetoolkit.rest.actuator.BiFunctionActuator} The actuator parameter is BiFunctionActuator
type.
* @throws RestException {@link io.github.nichetoolkit.rest.RestException} The rest exception is RestException
type.
* @see io.github.nichetoolkit.rest.RestException
* @see java.lang.Boolean
* @see java.lang.String
* @see io.github.nichetoolkit.rest.actuator.BiFunctionActuator
*/
public static void ofFalseThrowException(Boolean present, String message, String resource, BiFunctionActuator actuator) throws RestException {
if (GeneralUtils.isNotNull(present) && !present) {
X cause = actuator.actuate(resource, message);
log.error(cause.getMessage());
throw cause;
}
}
/**
* ofFalseThrowException
* The of false throw exception method.
* @param {@link io.github.nichetoolkit.rest.RestException} The generic parameter is RestException
type.
* @param present {@link java.lang.Boolean} The present parameter is Boolean
type.
* @param message {@link java.lang.String} The message parameter is String
type.
* @param resource {@link java.lang.String} The resource parameter is String
type.
* @param log {@link org.slf4j.Logger} The log parameter is Logger
type.
* @param actuator {@link io.github.nichetoolkit.rest.actuator.BiFunctionActuator} The actuator parameter is BiFunctionActuator
type.
* @throws RestException {@link io.github.nichetoolkit.rest.RestException} The rest exception is RestException
type.
* @see io.github.nichetoolkit.rest.RestException
* @see java.lang.Boolean
* @see java.lang.String
* @see org.slf4j.Logger
* @see io.github.nichetoolkit.rest.actuator.BiFunctionActuator
*/
public static void ofFalseThrowException(Boolean present, String message, String resource, Logger log, BiFunctionActuator actuator) throws RestException {
if (GeneralUtils.isNotNull(present) && !present) {
X cause = actuator.actuate(resource, message);
log.error(cause.getMessage());
throw cause;
}
}
/**
* ofNull
* The of null method.
* @param {@link java.lang.Object} The parameter can be of any type.
* @param {@link java.lang.Throwable} The generic parameter is Throwable
type.
* @param object T The object parameter is T
type.
* @param supplier {@link java.util.function.Supplier} The supplier parameter is Supplier
type.
* @throws X X The x is X
type.
* @see java.lang.Throwable
* @see org.springframework.lang.Nullable
* @see java.util.function.Supplier
* @see org.springframework.lang.NonNull
* @see X
*/
public static void ofNull(@Nullable T object, @NonNull Supplier supplier) throws X {
ofCauseThrow(xOfNull(object, supplier));
}
/**
* ofNull
* The of null method.
* @param {@link java.lang.Object} The parameter can be of any type.
* @param {@link java.lang.Throwable} The generic parameter is Throwable
type.
* @param object T The object parameter is T
type.
* @param log {@link org.slf4j.Logger} The log parameter is Logger
type.
* @param supplier {@link java.util.function.Supplier} The supplier parameter is Supplier
type.
* @throws X X The x is X
type.
* @see java.lang.Throwable
* @see org.springframework.lang.Nullable
* @see org.slf4j.Logger
* @see java.util.function.Supplier
* @see org.springframework.lang.NonNull
* @see X
*/
public static void ofNull(@Nullable T object, Logger log, @NonNull Supplier supplier) throws X {
ofCauseThrow(log, xOfNull(object, supplier));
}
/**
* ofNullError
* The of null error method.
* @param {@link java.lang.Object} The parameter can be of any type.
* @param {@link io.github.nichetoolkit.rest.RestError} The generic parameter is RestError
type.
* @param object T The object parameter is T
type.
* @param supplier {@link java.util.function.Supplier} The supplier parameter is Supplier
type.
* @see io.github.nichetoolkit.rest.RestError
* @see org.springframework.lang.Nullable
* @see java.util.function.Supplier
* @see org.springframework.lang.NonNull
*/
public static void ofNullError(@Nullable T object, @NonNull Supplier supplier) {
ofCauseThrowError(xOfNull(object, supplier));
}
/**
* ofNullError
* The of null error method.
* @param {@link java.lang.Object} The parameter can be of any type.
* @param {@link io.github.nichetoolkit.rest.RestError} The generic parameter is RestError
type.
* @param object T The object parameter is T
type.
* @param log {@link org.slf4j.Logger} The log parameter is Logger
type.
* @param supplier {@link java.util.function.Supplier} The supplier parameter is Supplier
type.
* @see io.github.nichetoolkit.rest.RestError
* @see org.springframework.lang.Nullable
* @see org.slf4j.Logger
* @see java.util.function.Supplier
* @see org.springframework.lang.NonNull
*/
public static void ofNullError(@Nullable T object, Logger log, @NonNull Supplier supplier) {
ofCauseThrowError(log, xOfNull(object, supplier));
}
/**
* ofNullException
* The of null exception method.
* @param {@link java.lang.Object} The parameter can be of any type.
* @param {@link io.github.nichetoolkit.rest.RestException} The generic parameter is RestException
type.
* @param object T The object parameter is T
type.
* @param actuator {@link io.github.nichetoolkit.rest.actuator.SupplierActuator} The actuator parameter is SupplierActuator
type.
* @throws RestException {@link io.github.nichetoolkit.rest.RestException} The rest exception is RestException
type.
* @see io.github.nichetoolkit.rest.RestException
* @see org.springframework.lang.Nullable
* @see io.github.nichetoolkit.rest.actuator.SupplierActuator
* @see org.springframework.lang.NonNull
*/
public static void ofNullException(@Nullable T object, @NonNull SupplierActuator actuator) throws RestException {
ofCauseThrowException(xOfNullActuator(object, actuator));
}
/**
* ofNullException
* The of null exception method.
* @param {@link java.lang.Object} The parameter can be of any type.
* @param {@link io.github.nichetoolkit.rest.RestException} The generic parameter is RestException
type.
* @param object T The object parameter is T
type.
* @param log {@link org.slf4j.Logger} The log parameter is Logger
type.
* @param actuator {@link io.github.nichetoolkit.rest.actuator.SupplierActuator} The actuator parameter is SupplierActuator
type.
* @throws RestException {@link io.github.nichetoolkit.rest.RestException} The rest exception is RestException
type.
* @see io.github.nichetoolkit.rest.RestException
* @see org.springframework.lang.Nullable
* @see org.slf4j.Logger
* @see io.github.nichetoolkit.rest.actuator.SupplierActuator
* @see org.springframework.lang.NonNull
*/
public static void ofNullException(@Nullable T object, Logger log, @NonNull SupplierActuator actuator) throws RestException {
ofCauseThrowException(log, xOfNullActuator(object, actuator));
}
/**
* ofEmpty
* The of empty method.
* @param {@link java.lang.Object} The parameter can be of any type.
* @param {@link java.lang.Throwable} The generic parameter is Throwable
type.
* @param object T The object parameter is T
type.
* @param supplier {@link java.util.function.Supplier} The supplier parameter is Supplier
type.
* @throws X X The x is X
type.
* @see java.lang.Throwable
* @see org.springframework.lang.Nullable
* @see java.util.function.Supplier
* @see org.springframework.lang.NonNull
* @see X
*/
public static void ofEmpty(@Nullable T object, @NonNull Supplier supplier) throws X {
ofCauseThrow(xOfEmpty(object, supplier));
}
/**
* ofEmpty
* The of empty method.
* @param {@link java.lang.Object} The parameter can be of any type.
* @param {@link java.lang.Throwable} The generic parameter is Throwable
type.
* @param object T The object parameter is T
type.
* @param log {@link org.slf4j.Logger} The log parameter is Logger
type.
* @param supplier {@link java.util.function.Supplier} The supplier parameter is Supplier
type.
* @throws X X The x is X
type.
* @see java.lang.Throwable
* @see org.springframework.lang.Nullable
* @see org.slf4j.Logger
* @see java.util.function.Supplier
* @see org.springframework.lang.NonNull
* @see X
*/
public static void ofEmpty(@Nullable T object, Logger log, @NonNull Supplier supplier) throws X {
ofCauseThrow(log, xOfEmpty(object, supplier));
}
/**
* ofEmptyError
* The of empty error method.
* @param {@link java.lang.Object} The parameter can be of any type.
* @param {@link io.github.nichetoolkit.rest.RestError} The generic parameter is RestError
type.
* @param object T The object parameter is T
type.
* @param supplier {@link java.util.function.Supplier} The supplier parameter is Supplier
type.
* @see io.github.nichetoolkit.rest.RestError
* @see org.springframework.lang.Nullable
* @see java.util.function.Supplier
* @see org.springframework.lang.NonNull
*/
public static void ofEmptyError(@Nullable T object, @NonNull Supplier supplier) {
ofCauseThrowError(xOfEmpty(object, supplier));
}
/**
* ofEmptyError
* The of empty error method.
* @param {@link java.lang.Object} The parameter can be of any type.
* @param {@link io.github.nichetoolkit.rest.RestError} The generic parameter is RestError
type.
* @param object T The object parameter is T
type.
* @param log {@link org.slf4j.Logger} The log parameter is Logger
type.
* @param supplier {@link java.util.function.Supplier} The supplier parameter is Supplier
type.
* @see io.github.nichetoolkit.rest.RestError
* @see org.springframework.lang.Nullable
* @see org.slf4j.Logger
* @see java.util.function.Supplier
* @see org.springframework.lang.NonNull
*/
public static void ofEmptyError(@Nullable T object, Logger log, @NonNull Supplier supplier) {
ofCauseThrowError(log, xOfEmpty(object, supplier));
}
/**
* ofEmptyException
* The of empty exception method.
* @param {@link java.lang.Object} The parameter can be of any type.
* @param {@link io.github.nichetoolkit.rest.RestException} The generic parameter is RestException
type.
* @param object T The object parameter is T
type.
* @param actuator {@link io.github.nichetoolkit.rest.actuator.SupplierActuator} The actuator parameter is SupplierActuator
type.
* @throws RestException {@link io.github.nichetoolkit.rest.RestException} The rest exception is RestException
type.
* @see io.github.nichetoolkit.rest.RestException
* @see org.springframework.lang.Nullable
* @see io.github.nichetoolkit.rest.actuator.SupplierActuator
* @see org.springframework.lang.NonNull
*/
public static void ofEmptyException(@Nullable T object, @NonNull SupplierActuator actuator) throws RestException {
ofCauseThrowException(xOfEmptyActuator(object, actuator));
}
/**
* ofEmptyException
* The of empty exception method.
* @param {@link java.lang.Object} The parameter can be of any type.
* @param {@link io.github.nichetoolkit.rest.RestException} The generic parameter is RestException
type.
* @param object T The object parameter is T
type.
* @param log {@link org.slf4j.Logger} The log parameter is Logger
type.
* @param actuator {@link io.github.nichetoolkit.rest.actuator.SupplierActuator} The actuator parameter is SupplierActuator
type.
* @throws RestException {@link io.github.nichetoolkit.rest.RestException} The rest exception is RestException
type.
* @see io.github.nichetoolkit.rest.RestException
* @see org.springframework.lang.Nullable
* @see org.slf4j.Logger
* @see io.github.nichetoolkit.rest.actuator.SupplierActuator
* @see org.springframework.lang.NonNull
*/
public static void ofEmptyException(@Nullable T object, Logger log, @NonNull SupplierActuator actuator) throws RestException {
ofCauseThrowException(log, xOfEmptyActuator(object, actuator));
}
/**
* ofInvalid
* The of invalid method.
* @param {@link java.lang.Object} The parameter can be of any type.
* @param {@link java.lang.Throwable} The generic parameter is Throwable
type.
* @param object T The object parameter is T
type.
* @param supplier {@link java.util.function.Supplier} The supplier parameter is Supplier
type.
* @throws X X The x is X
type.
* @see java.lang.Throwable
* @see org.springframework.lang.Nullable
* @see java.util.function.Supplier
* @see org.springframework.lang.NonNull
* @see X
*/
public static void ofInvalid(@Nullable T object, @NonNull Supplier supplier) throws X {
ofCauseThrow(xOfInvalid(object, supplier));
}
/**
* ofInvalid
* The of invalid method.
* @param {@link java.lang.Object} The parameter can be of any type.
* @param {@link java.lang.Throwable} The generic parameter is Throwable
type.
* @param object T The object parameter is T
type.
* @param log {@link org.slf4j.Logger} The log parameter is Logger
type.
* @param supplier {@link java.util.function.Supplier} The supplier parameter is Supplier
type.
* @throws X X The x is X
type.
* @see java.lang.Throwable
* @see org.springframework.lang.Nullable
* @see org.slf4j.Logger
* @see java.util.function.Supplier
* @see org.springframework.lang.NonNull
* @see X
*/
public static void ofInvalid(@Nullable T object, Logger log, @NonNull Supplier supplier) throws X {
ofCauseThrow(log, xOfInvalid(object, supplier));
}
/**
* ofInvalidError
* The of invalid error method.
* @param {@link java.lang.Object} The parameter can be of any type.
* @param {@link io.github.nichetoolkit.rest.RestError} The generic parameter is