Class ChecksBase<T,C extends ChecksBase<T,C>>
java.lang.Object
dev.prozilla.pine.common.util.checks.ChecksBase<T,C>
- Direct Known Subclasses:
ArrayChecks
,CollectionChecks
,ObjectChecks
,StringChecks
Utility class for chaining checks using functional programming on a named value
and throwing a descriptive error if one of the checks is not met.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal C
asString
(Consumer<StringChecks> stringChecks) Performs checks on the value as a string.final T
get()
protected abstract String
final C
Checks that the value is equal to a given object.final C
isNotEqualTo
(Object other) Checks that the value is not equal to a given object.final C
Checks that the value is not null.final C
protected abstract C
self()
-
Field Details
-
value
-
name
-
-
Constructor Details
-
ChecksBase
-
-
Method Details
-
named
-
get
-
asString
Performs checks on the value as a string.- Parameters:
stringChecks
- The checks to perform
-
isEqualTo
Checks that the value is equal to a given object.- Parameters:
other
- The object- Throws:
InvalidObjectException
- If the value is not equal to the object
-
isNotEqualTo
Checks that the value is not equal to a given object.- Parameters:
other
- The object- Throws:
InvalidObjectException
- If the value is equal to the object
-
isNotNull
Checks that the value is not null.- Throws:
InvalidObjectException
- If the value isnull
.
-
self
-
getDefaultName
-