Search in sources :

Example 1 with VersionBound

use of com.google.api.codegen.config.VersionBound in project toolkit by googleapis.

the class PackageMetadataTransformer method getDependencies.

private List<PackageDependencyView> getDependencies(PackageMetadataNamer namer, Map<String, VersionBound> dependencies, Set<String> whitelistedDependencies) {
    List<PackageDependencyView> protoPackageDependencies = new ArrayList<>();
    if (dependencies != null) {
        Map<String, VersionBound> dependenciesCopy = new HashMap<>(dependencies);
        if (whitelistedDependencies != null) {
            dependenciesCopy.keySet().retainAll(whitelistedDependencies);
        }
        for (Map.Entry<String, VersionBound> entry : dependenciesCopy.entrySet()) {
            PackageDependencyView packageDependency = PackageDependencyView.newBuilder().group(namer.getProtoPackageGroup()).name(entry.getKey()).versionBound(entry.getValue()).build();
            protoPackageDependencies.add(packageDependency);
        }
        // Ensures deterministic test results.
        Collections.sort(protoPackageDependencies);
    }
    return protoPackageDependencies;
}
Also used : VersionBound(com.google.api.codegen.config.VersionBound) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) HashMap(java.util.HashMap) Map(java.util.Map) PackageDependencyView(com.google.api.codegen.viewmodel.metadata.PackageDependencyView)

Aggregations

VersionBound (com.google.api.codegen.config.VersionBound)1 PackageDependencyView (com.google.api.codegen.viewmodel.metadata.PackageDependencyView)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1