Class JobTemplate.BaseBuilder<B extends JobTemplate.BaseBuilder<B,P>,P extends JobTemplate>

java.lang.Object
org.apache.gravitino.job.JobTemplate.BaseBuilder<B,P>
Direct Known Subclasses:
ShellJobTemplate.Builder, SparkJobTemplate.Builder
Enclosing class:
JobTemplate

public abstract static class JobTemplate.BaseBuilder<B extends JobTemplate.BaseBuilder<B,P>,P extends JobTemplate> extends Object
Builder class for constructing JobTemplate instances.
  • Constructor Details

    • BaseBuilder

      protected BaseBuilder()
      Constructor for the BaseBuilder. This constructor is protected to ensure that only subclasses can instantiate it.
  • Method Details

    • self

      protected abstract B self()
      Returns the current instance of the builder.
      Returns:
      the current builder instance
    • build

      public abstract P build()
      Build the JobTemplate instance.
      Returns:
      the constructed JobTemplate instance
    • withName

      public B withName(String name)
      Set the name of the job template.
      Parameters:
      name - the name of the job template.
      Returns:
      this Builder instance
    • withComment

      public B withComment(String comment)
      Set the comment for the job template.
      Parameters:
      comment - the comment or description of the job template
      Returns:
      this Builder instance
    • withExecutable

      public B withExecutable(String executable)
      Set the executable for the job template.
      Parameters:
      executable - the path to the executable
      Returns:
      this Builder instance
    • withArguments

      public B withArguments(List<String> arguments)
      Set the arguments for the job template.
      Parameters:
      arguments - the list of arguments
      Returns:
      this Builder instance
    • withEnvironments

      public B withEnvironments(Map<String,String> environments)
      Set the environment variables for the job template.
      Parameters:
      environments - the map of environment variables
      Returns:
      this Builder instance
    • withCustomFields

      public B withCustomFields(Map<String,String> customFields)
      Set the custom fields for the job template.
      Parameters:
      customFields - the map of custom fields
      Returns:
      this Builder instance
    • validate

      protected void validate()
      Validates the parameters of the job template.