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

Keep default values for fields if parameter isn't provided #71

Merged
merged 13 commits into from
Mar 24, 2024

Conversation

LeStegii
Copy link
Collaborator

  • Don't overwrite values if parameter isn't provided
  • cleanup some code

ERROR_CODES.md Outdated Show resolved Hide resolved
ERROR_CODES.md Outdated Show resolved Hide resolved
docs/controller/4-parameters.md Outdated Show resolved Hide resolved
ERROR_CODES.md Outdated Show resolved Hide resolved
@LeStegii LeStegii requested a review from Clashsoft March 24, 2024 14:51
Copy link
Member

@Clashsoft Clashsoft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but there was a suggestion for another usecase that could be integrated. Right in this case:

class Component1 {
  @Param("foo")
  IntegerProperty fooProperty;
}

class Component2 {
  IntegerProperty fooProperty;
  // ...
  show(component1, Map.of("foo", fooProperty));
}

There will be an error. In this case it makes sense to treat the attribute as a regular object instead of a WritableValue. I am unsure about other cases involving final, or if bind or even bindBidirectional might be wanted. But I guess as a default behavior, simple assignment should be possible.

@LeStegii
Copy link
Collaborator Author

I changed it so that the special logic for WritableValues only applies if the provided parameter isn't a WritableValue itself.
If so, the basic logic will be used instead.

# Conflicts:
#	framework/src/main/java/org/fulib/fx/controller/ControllerManager.java
@LeStegii LeStegii merged commit 6145bd9 into master Mar 24, 2024
5 checks passed
@Clashsoft Clashsoft deleted the feat/default-values branch March 24, 2024 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants