Skip to content

feature: add from first reference to ResourceID too #846

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

Merged
merged 3 commits into from
Jan 19, 2022

Conversation

csviri
Copy link
Collaborator

@csviri csviri commented Jan 18, 2022

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@@ -13,6 +13,16 @@ public static ResourceID fromResource(HasMetadata resource) {
resource.getMetadata().getNamespace());
}

public static Optional<ResourceID> fromFirstOwnerReference(HasMetadata resource) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would still put this method on the Mappers class because it's not easily findable here, imo.

Copy link
Collaborator Author

@csviri csviri Jan 19, 2022

Choose a reason for hiding this comment

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

Based on the current situation it would fit also there. But ResourceID already has fromResource static initializer. A lean usually to have those methods directly in the class, basically an utility class is always harder to find (actually already a problem if there is need to search for it).
Currently Mapper contains static init methods for PrimaryResourceRetriever, these might be also directly on that interface, so its obviouse how to create them and not search for Mappers.

So I kinda lean towards this, to have it as it is now. If you insist we can move it however, ok with that too.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah yes, and the method doesn't have the same exact semantics so yes, it makes kind of sense to keep it on ResourceID. Diff reviews sometimes make you miss context… 🤦🏼

@csviri csviri merged commit e5c3c71 into main Jan 19, 2022
@csviri csviri deleted the from-owner-refernce-on-resource-id branch January 19, 2022 11:29
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