Interface Builder<T extends Builder<T>>

All Known Implementing Classes:
AbstractBuilder, ClassBuilder, EnumBuilder

@API(status=STABLE, since="0.6.0") public sealed interface Builder<T extends Builder<T>> permits AbstractBuilder<T>
Builder of a Java class - which MAY generate a class, enum or record.
Since:
0.1.0
Author:
Chrimle
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static enum 
    The SemVer format of a generated class.
    static enum 
    The SemVer placement in generated classes.
  • Method Summary

    Modifier and Type
    Method
    Description
    Commits the currently uncommitted changes as a new class.
    default T
    commit(io.github.chrimle.semver.Change change)
    Commits the currently uncommitted changes as a new class.
    commit(io.github.chrimle.semver.SemVer semVer)
    Commits the currently uncommitted changes as a new class.
    io.github.chrimle.semver.SemVer
    Gets the semVer of the currently uncommitted class.
    setSemVer(io.github.chrimle.semver.SemVer semVer)
    Sets the semVer of the currently uncommitted class.
    Sets the versionFormat of the currently uncommitted class.
    Sets the versionPlacement of the currently uncommitted class.
    Updates the className of the currently uncommitted class.
    Updates the directory of the currently uncommitted class.
    Updates the packageName of the currently uncommitted class.
  • Method Details

    • setVersionFormat

      T setVersionFormat(Builder.VersionFormat versionFormat)
      Sets the versionFormat of the currently uncommitted class.

      Default: Builder.VersionFormat.COMPLETE

      Parameters:
      versionFormat - for the class.
      Returns:
      this Builder.
      Since:
      0.9.0
    • setVersionPlacement

      T setVersionPlacement(Builder.VersionPlacement versionPlacement)
      Sets the versionPlacement of the currently uncommitted class.

      Default: Builder.VersionPlacement.NONE.

      Parameters:
      versionPlacement - for the class.
      Returns:
      this Builder.
      Since:
      0.3.0
    • getSemVer

      io.github.chrimle.semver.SemVer getSemVer()
      Gets the semVer of the currently uncommitted class. NOTE: the semVer will be updated when committing the changes.
      Returns:
      the semVer of the class.
      Since:
      0.6.0
    • setSemVer

      T setSemVer(io.github.chrimle.semver.SemVer semVer)
      Sets the semVer of the currently uncommitted class.

      NOTE: the semVer will be updated when committing the changes.

      Parameters:
      semVer - for the class.
      Returns:
      this Builder.
      Since:
      0.5.0
    • updateDirectory

      T updateDirectory(String directory)
      Updates the directory of the currently uncommitted class.
      Parameters:
      directory - of the class.
      Returns:
      this Builder.
      Since:
      0.1.0
    • updateClassName

      T updateClassName(String className)
      Updates the className of the currently uncommitted class.
      Parameters:
      className - of the class.
      Returns:
      this Builder.
      Since:
      0.1.0
    • updatePackageName

      T updatePackageName(String packageName)
      Updates the packageName of the currently uncommitted class.
      Parameters:
      packageName - of the class.
      Returns:
      this Builder.
      Since:
      0.1.0
    • commit

      T commit()
      Commits the currently uncommitted changes as a new class. The semVer of the new class will be set automatically.
      Returns:
      this Builder.
      Since:
      0.1.0
    • commit

      @Contract("null -> fail; _ -> this") default T commit(io.github.chrimle.semver.Change change)
      Commits the currently uncommitted changes as a new class. The semVer of the new class will be set according to the given change.
      Parameters:
      change - for the new semVer.
      Returns:
      this Builder
      Throws:
      IllegalArgumentException - if change is null.
      Since:
      0.6.0
    • commit

      T commit(io.github.chrimle.semver.SemVer semVer)
      Commits the currently uncommitted changes as a new class. The semVer of the new class will be set to the given semVer.
      Parameters:
      semVer - for the new class.
      Returns:
      this Builder.
      Since:
      0.6.0