Class AddTimestampHandler

    • Field Detail

      • log

        @Nonnull
        private org.slf4j.Logger log
        Logger.
      • useCurrentTimeAsDefaultCreated

        private boolean useCurrentTimeAsDefaultCreated
        Flag indicating whether to use the current time as the Created time, if no value is explicitly supplied by the other supported mechanisms.
      • expiresOffsetFromCreated

        @Nullable
        private Duration expiresOffsetFromCreated
        Parameter indicating the offset from Created used to calculate the Expires time, if no Expires value is explicitly supplied via the other supported mechanisms.
      • createdValue

        @Nullable
        private Instant createdValue
        The effective Created value to use.
      • expiresValue

        @Nullable
        private Instant expiresValue
        The effective Expires value to use.
    • Constructor Detail

      • AddTimestampHandler

        public AddTimestampHandler()
    • Method Detail

      • getCreatedLookup

        @Nullable
        public Function<MessageContext,​Instant> getCreatedLookup()
        Get the context lookup function for the Created time.
        Returns:
        the lookup function
      • setCreatedLookup

        public void setCreatedLookup​(@Nullable
                                     Function<MessageContext,​Instant> lookup)
        Set the context lookup function for the Created time.
        Parameters:
        lookup - the lookup function
      • getExpiresLookup

        @Nullable
        public Function<MessageContext,​Instant> getExpiresLookup()
        Get the context lookup function for the Expires time.
        Returns:
        the lookup function
      • setExpiresLookup

        public void setExpiresLookup​(@Nullable
                                     Function<MessageContext,​Instant> lookup)
        Set the context lookup function for the Expires time.
        Parameters:
        lookup - the lookup function
      • isUseCurrentTimeAsDefaultCreated

        public boolean isUseCurrentTimeAsDefaultCreated()
        Get the flag indicating whether to use the current time as the Created time, if no value is explicitly supplied by the other supported mechanisms.
        Returns:
        true if should use current time, false if not
      • setUseCurrentTimeAsDefaultCreated

        public void setUseCurrentTimeAsDefaultCreated​(boolean flag)
        Set the flag indicating whether to use the current time as the Created time, if no value is explicitly supplied by the other supported mechanisms.
        Parameters:
        flag - true if should use currnet time, false if not
      • getExpiresOffsetFromCreated

        @Nullable
        public Duration getExpiresOffsetFromCreated()
        Get the parameter indicating the offset from Created used to calculate the Expires time, if no Expires value is explicitly supplied via the other supported mechanisms.
        Returns:
        the expires offset, or null
      • setExpiresOffsetFromCreated

        public void setExpiresOffsetFromCreated​(@Nullable
                                                Duration value)
        Set the parameter indicating the offset from Created used to calculate the Expires time, if no Expires value is explicitly supplied via the other supported mechanisms.
        Parameters:
        value - the expires offset, or null
      • getCreatedValue

        @Nullable
        protected Instant getCreatedValue​(@Nonnull
                                          MessageContext messageContext)
        Get the Created value.
        Parameters:
        messageContext - the current message context
        Returns:
        the effective Created DateTime value to use
      • getExpiresValue

        @Nullable
        protected Instant getExpiresValue​(@Nonnull
                                          MessageContext messageContext,
                                          @Nullable
                                          Instant created)
        Get the Expires value.
        Parameters:
        messageContext - the current message context
        created - the created value, if any
        Returns:
        the effective Expires DateTime value to use