You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am upgrading easy-random from 3.7.0 to 5.0.0 and I have a scenario where I want to generate a random bean but excluding a field deep down in the object hierarchy. Supposing that I have the structure below:
I want to generate a random instance of Person but excluding their street name. In 3.7.0 I could use nextObject(Person.class, "street.name"), reflecting the path of fields using a dot-separated string as excluded field.
In 5.0.0, according to #349, I understand I should implement an ExclusionPolicy.
However it is very hard to implement a policy that complies to my case without having access to the stack of RandomizationContextStackItem and to method getFieldFullName both in RandomizationContext. ExclusionPolicy gives me a handle to a RandomizerContext, not a RandomizationContext.
Is there an easy way to emulate the old behavior using version 5.0.0?
The text was updated successfully, but these errors were encountered:
Hello there,
First of all, thanks for awesome work.
I am upgrading easy-random from 3.7.0 to 5.0.0 and I have a scenario where I want to generate a random bean but excluding a field deep down in the object hierarchy. Supposing that I have the structure below:
I want to generate a random instance of
Person
but excluding their street name. In 3.7.0 I could usenextObject(Person.class, "street.name")
, reflecting the path of fields using a dot-separated string as excluded field.In 5.0.0, according to #349, I understand I should implement an
ExclusionPolicy
.However it is very hard to implement a policy that complies to my case without having access to the stack of
RandomizationContextStackItem
and to methodgetFieldFullName
both inRandomizationContext
.ExclusionPolicy
gives me a handle to aRandomizerContext
, not aRandomizationContext
.Is there an easy way to emulate the old behavior using version 5.0.0?
The text was updated successfully, but these errors were encountered: