All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.atlassian.bamboo.specs.codegen.emitters.credentials.SharedCredentialsIdentifierEmitter Maven / Gradle / Ivy

There is a newer version: 10.1.0
Show newest version
package com.atlassian.bamboo.specs.codegen.emitters.credentials;

import com.atlassian.bamboo.specs.api.builders.credentials.SharedCredentialsScope;
import com.atlassian.bamboo.specs.api.codegen.CodeGenerationContext;
import com.atlassian.bamboo.specs.api.codegen.CodeGenerationException;
import com.atlassian.bamboo.specs.api.model.credentials.SharedCredentialsIdentifierProperties;
import com.atlassian.bamboo.specs.codegen.emitters.value.EntityPropertiesEmitter;
import org.jetbrains.annotations.NotNull;

public class SharedCredentialsIdentifierEmitter extends EntityPropertiesEmitter {

    @NotNull
    @Override
    public String emitCode(@NotNull CodeGenerationContext context, @NotNull SharedCredentialsIdentifierProperties entity) throws CodeGenerationException {
        String constructorInvocation = emitConstructorInvocation(context, entity);
        context.importClassName(SharedCredentialsScope.class);
        return String.format("%s.scope(%s.%s)",
                constructorInvocation,
                SharedCredentialsScope.class.getSimpleName(),
                entity.getScope());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy