Class MethodDef.MethodDefBuilder

Enclosing class:
MethodDef

public static final class MethodDef.MethodDefBuilder extends AbstractElementBuilder<MethodDef.MethodDefBuilder>
The method builder definition.
Since:
1.0
Author:
Denis Stepanov
  • Method Details

    • returns

      public MethodDef.MethodDefBuilder returns(TypeDef type)
      The return type of the method. In a case of missing return type it will be extracted from the statements.
      Parameters:
      type - The return type
      Returns:
      the current builder
    • overrides

      public MethodDef.MethodDefBuilder overrides()
      Mark the method as an override.
      Returns:
      the current builder
    • overrides

      public MethodDef.MethodDefBuilder overrides(boolean overrides)
      Mark the method as an override.
      Parameters:
      overrides - The value
      Returns:
      the current builder
    • returns

      public MethodDef.MethodDefBuilder returns(Class<?> type)
    • addParameter

      @NonNull public @NonNull MethodDef.MethodDefBuilder addParameter(@NonNull @NonNull String name, @NonNull @NonNull TypeDef type)
      Add a parameter.
      Parameters:
      name - The name
      type - The type
      Returns:
      a builder
      Since:
      1.5
    • addParameter

      @NonNull public @NonNull MethodDef.MethodDefBuilder addParameter(@NonNull @NonNull TypeDef type)
      Add a parameter.
      Parameters:
      type - The type
      Returns:
      a builder
      Since:
      1.5
    • addParameter

      @NonNull public @NonNull MethodDef.MethodDefBuilder addParameter(@NonNull @NonNull ParameterDef parameterDef)
      Add a parameter.
      Parameters:
      parameterDef - The parameter def
      Returns:
      a builder
      Since:
      1.5
    • addParameters

      @NonNull public @NonNull MethodDef.MethodDefBuilder addParameters(@NonNull @NonNull Collection<ParameterDef> parameters)
      Add parameters.
      Parameters:
      parameters - The parameters
      Returns:
      a builder
      Since:
      1.5
    • addParameter

      @NonNull public @NonNull MethodDef.MethodDefBuilder addParameter(@NonNull @NonNull String name, @NonNull @NonNull Class<?> type)
      Add a parameter.
      Parameters:
      name - The name
      type - The type
      Returns:
      a builder
    • addParameter

      @NonNull public @NonNull MethodDef.MethodDefBuilder addParameter(@NonNull @NonNull Class<?> type)
      Add a parameter.
      Parameters:
      type - The type
      Returns:
      a builder
      Since:
      1.5
    • addParameters

      @NonNull public @NonNull MethodDef.MethodDefBuilder addParameters(@NonNull @NonNull Class<?>... types)
      Add a parameters.
      Parameters:
      types - The types
      Returns:
      a builder
      Since:
      1.5
    • addParameters

      @NonNull public @NonNull MethodDef.MethodDefBuilder addParameters(@NonNull @NonNull TypeDef... types)
      Add parameters.
      Parameters:
      types - The types
      Returns:
      a builder
      Since:
      1.5
    • addParameters

      @NonNull public @NonNull MethodDef.MethodDefBuilder addParameters(@NonNull @NonNull List<TypeDef> types)
      Add parameters.
      Parameters:
      types - The types
      Returns:
      a builder
      Since:
      1.5
    • addStaticStatement

      @NonNull public @NonNull MethodDef.MethodDefBuilder addStaticStatement(@NonNull @NonNull Function<List<VariableDef.MethodParameter>,StatementDef> bodyBuilder)
      Add a statement to the static method body.
      Parameters:
      bodyBuilder - The builder
      Returns:
      The builder
      Since:
      1.5
    • addStatement

      @NonNull public @NonNull MethodDef.MethodDefBuilder addStatement(@NonNull @NonNull StatementDef statement)
      Add a statement to the method body.
      Parameters:
      statement - The statement
      Returns:
      The builder
    • addStatement

      @NonNull public @NonNull MethodDef.MethodDefBuilder addStatement(@NonNull MethodDef.MethodBodyBuilder bodyBuilder)
      Add a statement to the method body.
      Parameters:
      bodyBuilder - The body builder
      Returns:
      The builder
    • addStatements

      @NonNull public @NonNull MethodDef.MethodDefBuilder addStatements(@NonNull @NonNull Collection<StatementDef> newStatements)
      Add statements to the method body.
      Parameters:
      newStatements - The new statements
      Returns:
      The builder
    • build

      public MethodDef build()
    • build

      @NonNull public @NonNull MethodDef build(@NonNull MethodDef.MethodBodyBuilder bodyBuilder)
      Build a method with a body builder.
      Parameters:
      bodyBuilder - The body builder
      Returns:
      The builder
    • buildStatic

      @NonNull public @NonNull MethodDef buildStatic(@NonNull @NonNull Function<List<VariableDef.MethodParameter>,StatementDef> bodyBuilder)
      Build a static method with a body builder.
      Parameters:
      bodyBuilder - The body builder
      Returns:
      The builder