Class BuilderValidator
java.lang.Object
org.jweaver.crawler.internal.util.BuilderValidator
The BuilderValidator class provides utility methods for validating builder parameters. It ensures
that parameters are not null or empty before being used to construct objects.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Collection
<T> requireNonEmpty
(Collection<T> object) Validates that the specified collection is not null.static <T> Collection
<T> requireNonEmpty
(Collection<T> object, String message) Validates that the specified collection is not null or empty.static <T> T
requireNonEmpty
(T object) Validates that the specified object is not null.static <T> T
requireNonEmpty
(T object, String message) Validates that the specified object is not null or empty.
-
Method Details
-
requireNonEmpty
Validates that the specified object is not null or empty.- Type Parameters:
T
- The type of the object.- Parameters:
object
- The object to validate.message
- The error message to be used if the validation fails.- Returns:
- The validated object.
- Throws:
NullPointerException
- if the object is null.IllegalArgumentException
- if the object is an empty string or collection.
-
requireNonEmpty
Validates that the specified collection is not null or empty.- Type Parameters:
T
- The type of elements in the collection.- Parameters:
object
- The collection to validate.message
- The error message to be used if the validation fails.- Returns:
- The validated collection.
- Throws:
NullPointerException
- if the collection is null.IllegalArgumentException
- if the collection is empty.
-
requireNonEmpty
public static <T> T requireNonEmpty(T object) Validates that the specified object is not null.- Type Parameters:
T
- The type of the object.- Parameters:
object
- The object to validate.- Returns:
- The validated object.
- Throws:
NullPointerException
- if the object is null.
-
requireNonEmpty
Validates that the specified collection is not null.- Type Parameters:
T
- The type of elements in the collection.- Parameters:
object
- The collection to validate.- Returns:
- The validated collection.
- Throws:
NullPointerException
- if the collection is null.
-