Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Assume @React on a Policy method #1555

Open
alexander-yevsyukov opened this issue Oct 18, 2024 · 0 comments
Open

Assume @React on a Policy method #1555

alexander-yevsyukov opened this issue Oct 18, 2024 · 0 comments

Comments

@alexander-yevsyukov
Copy link
Contributor

A custom policy in the user's code is implemented by extending the io.spine.server.event.Policy class and overriding the whenever() method. The user also should not forget to add the @React annotation to the method. Otherwise, the method won't be picked up for building routing schemas.

The last step is:

  1. Often forgotten, especially by new users. It takes long minutes of debugging to find out the frustrating fact of the missing the annotation.
  2. Does not look natural because we have the abstract base class and require implementing the method. Both are known to the framework.

The abstract method whenever() already has the annotation @ContractFor(handler = React::class) which nicely explains the matter, and links it semantically with the routing annotation @React.

Let's make the framework to take into account all classes descending from Policy and include their whenever() methods even if they do not have the @React annotation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

1 participant