-
-
Notifications
You must be signed in to change notification settings - Fork 245
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
Add BiDiLensSpec defaulted with factory method #1053
Comments
Label: feature request |
Have you tried to use a |
Yes, but I might have done it wrong. I struggled with the constructor, because I couldn't create a defaulted(name, Lens(Meta(false, location, paramMeta, name, description)) { default }, description) , but I dont have access to Query.instant().defaulted("start", Lens(meta = ???, { _ -> Instant.now() })) The source code isn't obvious either, so I have no clue what location and meta are, and if I can construct them myself easily, or what data should even go into them. If you have any advice, I would appreciate it. |
It seems the location and paramMeta come from the Query.instant()
.defaulted(
"start",
Lens(
meta =
Meta(
required = false,
location = Query.location,
paramMeta = ParamMeta.StringParam,
name = "start",
description = "My description of start"),
{ _ -> Instant.now() })) Quite verbose compared to e.g. a |
I've made the defaulted mechanism take a LensExtractor
|
I would appreciate a
defaulted
which is re-evaluated every time, so I can use e.g.Instant.now()
,LocalDate.now()
etc.I currently do this:
And would appreciate if I could do this:
The name does not need to be
defaulted
, if this collides with existing signatures. Other names could be:(I don't want it lazy, it's active/recompute every time),defaultedLazy
defaultFactory
,defaultedWithFactory
,defaultedComputed
,computeDefault
, etc..I tried adding the functionality in my own codebase, but I failed because
paramMeta
was private, andget
andset
as well, so extension functions on BiDiLensSpec or inheritance of BiDiLens didn't quickly solve my problem.The text was updated successfully, but these errors were encountered: