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

DRAFT - Split PLCondition into DB and post-fetch conditions #89

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

effiban
Copy link
Contributor

@effiban effiban commented Feb 18, 2024

No description provided.

if (isVirtual()) {
throw new UnsupportedOperationException("The equals operation is unsupported for virtual fields");
throw new UnsupportedOperationException("PLConditions cannot be built for virtual fields");
Copy link
Contributor Author

@effiban effiban Feb 18, 2024

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")));
}
Copy link
Contributor Author

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

@effiban effiban changed the title Split PLCondition into DB and post-fetch conditions DRAFT - Split PLCondition into DB and post-fetch conditions Feb 18, 2024
}

private boolean valuesEqual(final Triptional<T> thisTriptional, final T otherValue) {
return thisTriptional.matches(thisValue -> valuesEqual(thisValue, otherValue));
Copy link
Contributor Author

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> {
Copy link
Contributor

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

Copy link
Contributor Author

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> {
Copy link
Contributor

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

Copy link
Contributor Author

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>> {
Copy link
Contributor

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?

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