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

com.atlassian.bamboo.specs.codegen.emitters.task.BaseVcsTaskEmitter Maven / Gradle / Ivy

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

import com.atlassian.bamboo.specs.api.codegen.CodeGenerationContext;
import com.atlassian.bamboo.specs.api.codegen.CodeGenerationException;
import com.atlassian.bamboo.specs.codegen.emitters.value.EntityPropertiesEmitter;
import com.atlassian.bamboo.specs.model.task.BaseVcsTaskProperties;
import org.jetbrains.annotations.NotNull;

public class BaseVcsTaskEmitter extends EntityPropertiesEmitter {
    @NotNull
    @Override
    public String emitCode(@NotNull CodeGenerationContext context, @NotNull T entity) throws CodeGenerationException {
        initBuilderClass(entity);
        fieldsToSkip.add("defaultRepository");
        if (entity.isDefaultRepository()) {
            context.incIndentation();
            final String defaultRepositoryCall = context.newLine() + ".defaultRepository()";
            context.decIndentation();
            return emitConstructorInvocation(context, entity) + defaultRepositoryCall + emitFields(context, entity);
        }
        return super.emitCode(context, entity);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy