Class Account.Builder
- java.lang.Object
-
- de.japrost.jabudget.domain.account.Account.Builder
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Account
build()
Build the account.static Account.Builder
builder()
Create an empty account builder.static Account.Builder
builder(Account account)
Create an account builder by example;static Account.Builder
builder(java.lang.String id)
Create an account builder with all required fields.java.util.Optional<Account>
buildOptional()
Build the account if it would be valid.Account.Builder
setId(java.lang.String id)
Sets the id of an Account.Account.Builder
setName(java.lang.String name)
Sets the given name of an Account.
-
-
-
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 benull
.
-
Builder
public Builder(Account account)
Create an account builder by example;- Parameters:
account
- the example account. MAY BEnull
.
-
-
Method Detail
-
builder
public static Account.Builder builder()
Create an empty account builder.- Returns:
- the
Account.Builder
.
-
builder
public static Account.Builder builder(java.lang.String id)
Create an account builder with all required fields.- Parameters:
id
- the id. MUST NOT benull
.- Returns:
- the
Account.Builder
.
-
builder
public static Account.Builder builder(Account account)
Create an account builder by example;- Parameters:
account
- the example account.- 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 benull
.- 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
-
-