Class Account.Builder

  • Enclosing class:
    Account

    public static class Account.Builder
    extends java.lang.Object
    Builder for Accounts.
    • Constructor Detail

      • Builder

        public Builder()
        Create an empty account builder.
      • Builder

        public Builder​(java.lang.String id)
        Create an account builder with all required fields.
        Parameters:
        id - the id. MUST NOT be null.
      • Builder

        public Builder​(Account account)
        Create an account builder by example;
        Parameters:
        account - the example account. MAY BE null.
    • Method Detail

      • builder

        public static Account.Builder builder​(java.lang.String id)
        Create an account builder with all required fields.
        Parameters:
        id - the id. MUST NOT be null.
        Returns:
        the Account.Builder.
      • build

        public Account build()
        Build the account.
        Returns:
        a new account instance.
      • buildOptional

        public java.util.Optional<Account> buildOptional()
        Build the account if it would be valid.
        Returns:
        a new account instance or an empty optional.
      • setId

        public Account.Builder setId​(java.lang.String id)
        Sets the id of an Account. MUST NOT be null.
        Parameters:
        id - the id of an Account
        Returns:
        this
      • setName

        public Account.Builder setName​(java.lang.String name)
        Sets the given name of an Account.
        Parameters:
        name - the new given name of an Account
        Returns:
        this