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

com.lq.cli.comment.CreateTask Maven / Gradle / Ivy

package com.lq.cli.comment;

import com.lq.comment.util.FileUtil;

import java.io.File;
import java.io.IOException;
import java.util.concurrent.Callable;

public abstract class CreateTask implements Callable {

    protected TaskArgs taskArgs;
    private String packageName;

    public CreateTask(TaskArgs taskArgs) {
        this.taskArgs = taskArgs;
    }

    protected void setPackageName(String packageName){
        this.packageName = packageName;
    }

    protected String getPackageName() {
        return packageName;
    }

    protected boolean checkDir(){
        File dir = new File(taskArgs.rootPackagePath+packageName);
        if (!dir.exists()){
            return dir.mkdir();
        }
        return true;
    }

    protected void createFile(String fileName,String content) throws IOException {
        File file = new File(taskArgs.rootPackagePath+packageName+File.separator+fileName);
        if (!file.exists()){
            FileUtil.createWriteFile(file,content);
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy