-
Notifications
You must be signed in to change notification settings - Fork 2
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
DRAFT - Split PLCondition into DB and post-fetch conditions #89
base: master
Are you sure you want to change the base?
Conversation
bbd4768
to
7ff608f
Compare
if (isVirtual()) { | ||
throw new UnsupportedOperationException("The equals operation is unsupported for virtual fields"); | ||
throw new UnsupportedOperationException("PLConditions cannot be built for virtual fields"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed this should be replaced later on with a condition that checks the number of fields in the virtual field - but right now we don't have a method returning number of fields, and it would probably not be efficient
hasFieldValues(fieldValue(TestParentEntityType.ID, 2), | ||
fieldValue(TestParentEntityType.FIELD1, "ParentBravo"), | ||
fieldValue(TestParentEntityType.FIELD2, "ParentBravo"))); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove because this method is changed to work only for post-fetch
7ff608f
to
7576627
Compare
} | ||
|
||
private boolean valuesEqual(final Triptional<T> thisTriptional, final T otherValue) { | ||
return thisTriptional.matches(thisValue -> valuesEqual(thisValue, otherValue)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method calls the public valuesEqual()
and that way, ensures that the equality function will be used and not the default equals (this fixes a bug we had).
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
public class PLCondition { | ||
public class PLCondition implements PLBaseCondition<PLCondition> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@effiban
Let's call it PLFetchCondition
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about it, but wasn't sure if we want to refactor this name - but I like the name
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
public class PLPostFetchCondition implements PLBaseCondition<PLPostFetchCondition> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@effiban
Let's call it PLEntityCondition
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, but I'm actually not sure it will be clear
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
public interface PLBaseCondition<C extends PLBaseCondition<C>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@effiban
Why do we need a common interface?
No description provided.