Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Refine Custom Autotimestamp #1862

Open
codeconsole opened this issue Jan 12, 2025 · 0 comments
Open

Refine Custom Autotimestamp #1862

codeconsole opened this issue Jan 12, 2025 · 0 comments

Comments

@codeconsole
Copy link
Contributor

codeconsole commented Jan 12, 2025

  1. Decide on better naming strategy that is convenient and also concise and clear to understand.

Convenient - minimal use of imports, ability to use default value of annotation
Clear to Understand - projects a clear understanding of what the annotation is doing without having to read docs
Concise - The annotation will most likely be used repeatedly multiple domain classes. It should not be overly verbose.

  1. Optimization - Use an AST transformation to accelerate runtime. While still O(1), performance could be improved moving the annotation processing to compile time. Performance would then be aligned with static constraints.

  2. Disable rendering of fields on edit/create page similar to dateCreated and lastUpdated

Requires 2 or 3 imports:

class User {

    String username
    String password

    @AutoTimestamp(CREATED) LocalDateTime created
    @AutoTimestamp(UPDATED) LocalDateTime modified

    Date dateCreated
    Date lastUpdated
}

Decisions:

  1. What should be default behavior? Creation only or Update only?
  2. If Aliases are to be used, should constants be removed and replaced with a binary option? (true/false)
  3. If constants, are maintained, is there a more concise approach available? Rename EventType to Event?

1 import:

    @AutoTimestamp(AutoTimestamp.Event.CREATED) LocalDateTime created
    @AutoTimestamp LocalDateTime modified

Middle ground?
1 import:

    @AutoTimestamp(AutoTimestamp.Type.DateCreated) LocalDateTime created
    @AutoTimestamp(AutoTimestamp.Type.LastUpdated) LocalDateTime modified
    @AutoTimestamp LocalDateTime updated // also works
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant