Skip to content

Conversation

@bbakerman
Copy link
Member

@bbakerman bbakerman commented Sep 15, 2021

A PR on getting schema usage stats and "reference" ability

@bbakerman bbakerman changed the title WIP - Schema Usage support Schema Usage support Jan 12, 2022
}


private final static Set<String> SPECIFIED_DIRECTIVES = ImmutableSet.of(
Copy link
Member

Choose a reason for hiding this comment

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

we have the same methods/logic already in DirectiveInfo I believe.

Copy link
Member Author

Choose a reason for hiding this comment

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

nice

@Internal
static class Builder {
Map<String, Integer> fieldReferenceCounts = new HashMap<>();
Map<String, Integer> inputFieldReferenceCounts = new HashMap<>();
Copy link
Member

Choose a reason for hiding this comment

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

I would recommend ImmutableMaps.Builder here, which preserve the order and are immutable OR our beloved LinkedHashMap or a comment why the order is never interesting.

Copy link
Member Author

Choose a reason for hiding this comment

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

ImmutableMap.Builder does not support compute like behavior. I want to accumulate values (counts) against type names.

            private BiFunction<String, Integer, Integer> incCount() {
                return (k, v) -> v == null ? 1 : v + 1;
            }

builder.fieldReferenceCounts.compute(fieldType.getName(), incCount());

With map builder it has only PUT and no read capability for past values

So I cant use it. I do use it on getters however. I will improve it to create these once and once only

@bbakerman bbakerman added this to the 18.0 milestone Feb 4, 2022
@bbakerman bbakerman merged commit 35b8dcd into master Feb 4, 2022
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.

3 participants