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

GH-688: Added getLabel OptionalMethod for Optional #2279

Conversation

SakshiSaini17092
Copy link
Contributor

@SakshiSaini17092 SakshiSaini17092 commented May 27, 2020

Signed-off-by: SakshiSaini17092 sakshi17092@iiitd.ac.in

GitHub issue resolved: #688

Briefly describe the changes proposed in this PR:
Added getLabel function for Optional.


PR Author Checklist (see the contributor guidelines for more details):

  • my pull request is self-contained
  • I've added tests for the changes I made
  • I've applied code formatting (you can use mvn process-resources to format from the command line)
  • every commit message starts with the issue number (GH-xxxx) followed by a meaningful description of the change
  • every commit has been signed off

Note: we merge all feature pull requests using squash and merge. See RDF4J git merge strategy for more details.

Signed-off-by: SakshiSaini17092 <sakshi17092@iiitd.ac.in>
@@ -51,6 +48,11 @@ public static String getLabel(Value v, String fallback) {
return v instanceof Literal ? getLabel((Literal) v, fallback) : fallback;
}

public static String getLabel(Optional v, String fallback) {

return v instanceof Optional ? getLabel((Value) v.orElseGet(null), fallback) : fallback;
Copy link
Contributor

Choose a reason for hiding this comment

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

You don't need to check if v is an Optional - it always is (because that's the type of the argument) - though perhaps you could check that it is not null.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes I fixed that in my latest commit.

import java.util.IllformedLocaleException;
import java.util.Locale;
import java.util.Objects;
import java.util.*;
Copy link
Contributor

Choose a reason for hiding this comment

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

I assume this is something that your editor has done automatically - could you change it? We don't use wildcards for imports.

If you are using Eclipse IDE, it's really easy to change this btw: go to 'Preferences' -> 'Java' -> 'Code Style' -> 'Organize imports', and where it says "number of imports needed for .*" set it to some very high number (99 for example).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this is also done.

@abrokenjester abrokenjester changed the base branch from master to develop May 28, 2020 01:45
Signed-off-by: SakshiSaini17092 <sakshi17092@iiitd.ac.in>
Copy link
Contributor

@abrokenjester abrokenjester left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@abrokenjester
Copy link
Contributor

If you haven't already, could you comment on #2235 and leave your names, so we can include them in the release notes? Thanks.

@abrokenjester abrokenjester merged commit 55b5b54 into eclipse-rdf4j:develop May 28, 2020
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.

Add Literals.getLabel method that accepts Optional input value
2 participants