private static <L> void populateMetricTypesForResourceType(
            ResourceType.Builder<?, L> resourceTypeBuilder,
            TypeSets.Builder<L> typeSetsBuilder) {

        Map<Name, TypeSet<MetricType<L>>> metricTypeSets = typeSetsBuilder.getMetricTypeSets();
        List<Name> metricSetNames = resourceTypeBuilder.getMetricSetNames();
        for (Name metricSetName : metricSetNames) {
            TypeSet<MetricType<L>> metricSet = metricTypeSets.get(metricSetName);
            if (metricSet != null && metricSet.isEnabled()) {
                resourceTypeBuilder.metricTypes(metricSet.getTypeMap().values());
            }
        }

    }
private static < L > void populateMetricTypesForResourceType ( ResourceType . Builder < ? , L > resourceTypeBuilder , TypeSets . Builder < L > typeSetsBuilder ) { Map < Name , TypeSet < MetricType < L > > > metricTypeSets = typeSetsBuilder . getMetricTypeSets ( ) ; List < Name > metricSetNames = resourceTypeBuilder . getMetricSetNames ( ) ; for ( Name metricSetName : metricSetNames ) { TypeSet < MetricType < L > > metricSet = metricTypeSets . get ( metricSetName ) ; if ( metricSet != null && metricSet . isEnabled ( ) ) { resourceTypeBuilder . metricTypes ( metricSet . getTypeMap ( ) . values ( ) ) ; } } }
Given a resource type builder, this will fill in its metric types.

@param resourceTypeBuilder the type being built whose metric types are to be filled in
@param typeSetsBuilder all type metadata - this is where our metrics are