Class PushMessageValidator
java.lang.Object
io.micronaut.gcp.pubsub.validation.PushMessageValidator
- All Implemented Interfaces:
jakarta.validation.ConstraintValidator<ValidPushMessage,
PushRequest.PushMessage>
@Introspected
public class PushMessageValidator
extends Object
implements jakarta.validation.ConstraintValidator<ValidPushMessage,PushRequest.PushMessage>
A validator for incoming PubSub push messages.
- Since:
- 5.4.0
- Author:
- Jeremy Grelle
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
isValid
(@Nullable PushRequest.PushMessage value, @NonNull jakarta.validation.ConstraintValidatorContext context) Validates pub sub push messages, ensuring they meet the specified constraint that a message must contain either a non-emptydata
field, or at least one non-emptyattribute
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface jakarta.validation.ConstraintValidator
initialize
-
Constructor Details
-
PushMessageValidator
public PushMessageValidator()
-
-
Method Details
-
isValid
public boolean isValid(@Nullable PushRequest.PushMessage value, @NonNull @NonNull jakarta.validation.ConstraintValidatorContext context) Validates pub sub push messages, ensuring they meet the specified constraint that a message must contain either a non-emptydata
field, or at least one non-emptyattribute
.- Specified by:
isValid
in interfacejakarta.validation.ConstraintValidator<ValidPushMessage,
PushRequest.PushMessage> - Parameters:
value
- The push message to validatecontext
- The context object- Returns:
- whether the push message is valid
-