Search in sources :

Example 1 with IamResourceView

use of com.google.api.codegen.viewmodel.IamResourceView in project toolkit by googleapis.

the class IamResourceTransformer method generateIamResources.

public List<IamResourceView> generateIamResources(InterfaceContext context) {
    List<IamResourceView> resources = new ArrayList<>();
    for (FieldModel field : context.getProductConfig().getInterfaceConfig(context.getInterfaceModel()).getIamResources()) {
        String resourceTypeName = context.getImportTypeTable().getAndSaveNicknameFor(field.getParentTypeName(context.getImportTypeTable()).getFullName());
        resources.add(IamResourceView.builder().resourceGetterFunctionName(context.getNamer().getIamResourceGetterFunctionName(field)).paramName(context.getNamer().getIamResourceParamName(field)).exampleName(context.getNamer().getIamResourceGetterFunctionExampleName(context.getInterfaceConfig(), field)).fieldName(context.getNamer().publicFieldName(Name.from(field.getSimpleName()))).resourceTypeName(resourceTypeName).resourceConstructorName(context.getNamer().getTypeConstructor(resourceTypeName)).build());
    }
    return resources;
}
Also used : ArrayList(java.util.ArrayList) FieldModel(com.google.api.codegen.config.FieldModel) IamResourceView(com.google.api.codegen.viewmodel.IamResourceView)

Aggregations

FieldModel (com.google.api.codegen.config.FieldModel)1 IamResourceView (com.google.api.codegen.viewmodel.IamResourceView)1 ArrayList (java.util.ArrayList)1