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

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    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-empty data field, or at least one non-empty attribute.

    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-empty data field, or at least one non-empty attribute.
      Specified by:
      isValid in interface jakarta.validation.ConstraintValidator<ValidPushMessage,PushRequest.PushMessage>
      Parameters:
      value - The push message to validate
      context - The context object
      Returns:
      whether the push message is valid