Annotation Interface DateUpdated


@Retention(RUNTIME) @Target({METHOD,FIELD}) @Documented @AutoPopulated public @interface DateUpdated
Can be applied to date type to indicate the property should be populated when it was last updated.
Since:
1.0
Author:
graemerocher
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The date created name.
    static final String
    The metadata key for skipIfPresent().
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    When true, an existing non-null value will be preserved and not overwritten during auto-population on insert.
    Allows to truncate the auto set date value.
  • Field Details

  • Element Details

    • skipIfPresent

      boolean skipIfPresent
      When true, an existing non-null value will be preserved and not overwritten during auto-population on insert. This is intended for insert-time use cases such as backfills or imports where a caller already has a last-updated value. On later updates, @DateUpdated keeps its normal semantics and is always refreshed by Micronaut Data regardless of this flag or the current value. Default is false to preserve existing behavior.
      Returns:
      true if the existing value should be preserved, false otherwise
      Since:
      5.0
      Default:
      false
    • truncatedTo

      ChronoUnit truncatedTo
      Allows to truncate the auto set date value.
      Returns:
      the truncated to constant
      Since:
      3.4.2
      Default:
      FOREVER