Class Method.Builder

All Implemented Interfaces:
ContentBuilder<Method.Builder>, Builder<Method.Builder,Method>, Supplier<Method>
Enclosing class:
Method

public static final class Method.Builder extends Executable.Builder<Method.Builder,Method>
Fluent API builder for Method.
  • Method Details

    • build

      public Method build()
      Description copied from interface: Builder
      Build the instance from this builder.
      Returns:
      instance of the built type
    • content

      public Method.Builder content(List<String> content)
      Description copied from interface: ContentBuilder
      Set new content. This method replaces previously created content in this builder.
      Specified by:
      content in interface ContentBuilder<Method.Builder>
      Overrides:
      content in class Executable.Builder<Method.Builder,Method>
      Parameters:
      content - content to be set
      Returns:
      updated builder instance
    • isFinal

      public Method.Builder isFinal(boolean isFinal)
      Whether this method is final.
      Parameters:
      isFinal - method is final
      Returns:
      updated builder instance
    • isStatic

      public Method.Builder isStatic(boolean isStatic)
      Whether this method is static.
      Parameters:
      isStatic - method is static
      Returns:
      updated builder instance
    • isAbstract

      public Method.Builder isAbstract(boolean isAbstract)
      Whether this method is abstract.
      Parameters:
      isAbstract - method is abstract
      Returns:
      updated builder instance
    • isDefault

      public Method.Builder isDefault(boolean isDefault)
      Whether this method is default.
      Parameters:
      isDefault - method is default
      Returns:
      updated builder instance
    • returnType

      public Method.Builder returnType(TypeName type)
      Set return type of the method. Default is void.
      Parameters:
      type - return type
      Returns:
      updated builder instance
    • returnType

      public Method.Builder returnType(TypeName type, String description)
      Set return type of the method. Default is void.
      Parameters:
      type - return type
      description - return type description
      Returns:
      updated builder instance
    • returnType

      public Method.Builder returnType(Consumer<Returns.Builder> consumer)
      Set return type of the method. Default is void.
      Parameters:
      consumer - return type builder consumer
      Returns:
      updated builder instance
    • returnType

      public Method.Builder returnType(Supplier<Returns> supplier)
      Set return type of the method. Default is void.
      Parameters:
      supplier - return type supplier
      Returns:
      updated builder instance
    • returnType

      public Method.Builder returnType(Returns returnType)
      Set return type of the method. Default is void.
      Parameters:
      returnType - return type
      Returns:
      updated builder instance
    • addGenericArgument

      public Method.Builder addGenericArgument(TypeArgument typeArgument)
      Add generic argument to be declared by this method.
      Parameters:
      typeArgument - argument to be declared
      Returns:
      updated builder instance
    • description

      public Method.Builder description(String description)
    • description

      public Method.Builder description(List<String> description)
    • addDescriptionLine

      public Method.Builder addDescriptionLine(String line)
    • addAnnotation

      public Method.Builder addAnnotation(Annotation annotation)
      Add new annotation to the component.
      Parameters:
      annotation - annotation instance
      Returns:
      updated builder instance
    • addAnnotation

      public Method.Builder addAnnotation(Consumer<Annotation.Builder> consumer)
      Add new annotation to the component.
      Parameters:
      consumer - annotation builder consumer
      Returns:
      updated builder instance
    • addAnnotation

      public Method.Builder addAnnotation(Annotation.Builder builder)
      Add new annotation to the component.
      Parameters:
      builder - annotation builder
      Returns:
      updated builder instance
    • addAnnotation

      public Method.Builder addAnnotation(Annotation annotation)
      Add new annotation to the component.
      Parameters:
      annotation - annotation instance
      Returns:
      updated builder instance
    • name

      public Method.Builder name(String name)
    • includeImport

      public Method.Builder includeImport(boolean includeImport)
      Whether to include import type information among the imports.
      Parameters:
      includeImport - whether imports should be included
      Returns:
      updated builder instance