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

Rename methods that don't do well without "get" to "findX/findXOrCreate" #2332

Merged
merged 1 commit into from
Apr 24, 2021

Conversation

dualspiral
Copy link
Contributor

@dualspiral dualspiral commented Apr 22, 2021

SpongeAPI | Sponge

See #2320. Basically here to ensure that we're okay with the proposed renames.

@dualspiral dualspiral added the api: 8 (u) version: 1.16 (unsupported since Oct 17th 2023) label Apr 22, 2021
@dualspiral dualspiral changed the title First round of finds Rename methods that don't do well without "get" to "findX/findXOrCreate" Apr 22, 2021
@@ -75,15 +75,15 @@
* @return The profile, if present, or {@link Optional#empty()} if
* the cache did not contain a profile with the provided id
*/
Optional<GameProfile> byId(UUID uniqueId);
Optional<GameProfile> findById(UUID uniqueId);
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 originally wanted to drop "byId" etc. but the problem is that findByIds and findByNames have the same erasure so wouldn't work out so well.

We could have find for the singular returns, and keep the current names for the... well, current values!

@@ -69,7 +69,7 @@
* @param name The state property name
* @return The state property, if available
*/
Optional<StateProperty<?>> statePropertyByName(String name);
Optional<StateProperty<?>> findStateProperty(String name);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could just be findProperty() instead?

There is the additional complication that there are other stateProperty methods that also return Optionals, but they are more tied into getting a property from a key. It's less of a search than using a name is. Is there a differentiation here, or should all of these methods be findStateProperty?

I can see the argument for saying "find" is for use by a free form identifier, lack of find when passing some key like object in, but we should decide this now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: 8 (u) version: 1.16 (unsupported since Oct 17th 2023)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant