use of com.google.api.codegen.transformer.java.JavaPackageMetadataNamer in project toolkit by googleapis.
the class JavaPackageMetadataTransformer method generateMetadataViewBuilders.
/**
* Creates a partially initialized builders that can be used to build PackageMetadataViews later.
*/
protected final List<PackageMetadataView.Builder> generateMetadataViewBuilders(ApiModel model, PackageMetadataConfig config, ArtifactType artifactType) {
JavaPackageMetadataNamer namer = new JavaPackageMetadataNamer(config.packageName(TargetLanguage.JAVA), artifactType);
List<PackageDependencyView> additionalDependencies = new ArrayList<>();
if (!SERVICES_WITH_NO_RESOURCE_NAMES.contains(config.shortName())) {
PackageDependencyView packageDependency = PackageDependencyView.newBuilder().group("com.google.api").name("api-common").versionBound(config.apiCommonVersionBound(TargetLanguage.JAVA)).build();
additionalDependencies.add(packageDependency);
}
ArrayList<PackageMetadataView.Builder> viewBuilders = new ArrayList<>();
for (Map.Entry<String, String> entry : getSnippetsOutput().entrySet()) {
PackageMetadataView.Builder viewBuilder = metadataTransformer.generateMetadataView(namer, config, model, entry.getKey(), entry.getValue(), TargetLanguage.JAVA).additionalDependencies(additionalDependencies).identifier(namer.getMetadataIdentifier()).protoPackageName(namer.getProtoPackageName()).grpcPackageName(namer.getGrpcPackageName()).publishProtos(artifactType == ArtifactType.PROTOBUF);
viewBuilders.add(viewBuilder);
}
return viewBuilders;
}
use of com.google.api.codegen.transformer.java.JavaPackageMetadataNamer in project toolkit by googleapis.
the class JavaPackageTransformer method generateMetadataViewBuilders.
/**
* Creates a partially initialized builders that can be used to build PackageMetadataViews later.
*/
protected final List<PackageMetadataView.Builder> generateMetadataViewBuilders(ApiModel model, PackageMetadataConfig config, PackagingArtifactType artifactType) {
String packageName = config.packageName();
JavaPackageMetadataNamer namer = new JavaPackageMetadataNamer(packageName, artifactType);
List<PackageDependencyView> additionalDependencies = new ArrayList<>();
if (!SERVICES_WITH_NO_RESOURCE_NAMES.contains(config.shortName())) {
PackageDependencyView packageDependency = PackageDependencyView.newBuilder().group("com.google.api").name("api-common").versionBound(config.apiCommonVersionBound(TargetLanguage.JAVA)).build();
additionalDependencies.add(packageDependency);
}
ArrayList<PackageMetadataView.Builder> viewBuilders = new ArrayList<>();
for (Map.Entry<String, String> entry : getSnippetsOutput().entrySet()) {
PackageMetadataView.Builder viewBuilder = metadataTransformer.generateMetadataView(namer, config, model, entry.getKey(), entry.getValue(), TargetLanguage.JAVA).additionalDependencies(additionalDependencies).packageName(packageName).identifier(namer.getMetadataIdentifier()).protoPackageName(namer.getProtoPackageName()).grpcPackageName(namer.getGrpcPackageName()).publishProtos(artifactType == PackagingArtifactType.PROTOBUF);
viewBuilders.add(viewBuilder);
}
return viewBuilders;
}
Aggregations