Package com.arakelian.faker.model
Class ImmutablePerson.Builder
- java.lang.Object
-
- com.arakelian.faker.model.ImmutablePerson.Builder
-
- Enclosing class:
- ImmutablePerson
@NotThreadSafe public static final class ImmutablePerson.Builder extends java.lang.ObjectBuilds instances of typeImmutablePerson. Initialize attributes and then invoke thebuild()method to create an immutable instance.Builderis not thread-safe and generally should not be stored in a field or collection, but instead used immediately to create instances.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ImmutablePerson.Builderage(java.lang.Integer age)Initializes the value for theageattribute.ImmutablePerson.Builderbirthdate(java.time.ZonedDateTime birthdate)Initializes the value for thebirthdateattribute.ImmutablePersonbuild()Builds a newImmutablePerson.ImmutablePerson.Buildercomments(java.lang.String comments)Initializes the value for thecommentsattribute.ImmutablePerson.Buildercreated(java.time.ZonedDateTime created)Initializes the value for thecreatedattribute.ImmutablePerson.BuilderfirstName(java.lang.String firstName)Initializes the value for thefirstNameattribute.ImmutablePerson.Builderfrom(AbstractModel instance)Fill a builder with attribute values from the providedcom.arakelian.faker.model.AbstractModelinstance.ImmutablePerson.Builderfrom(Person instance)Fill a builder with attribute values from the providedcom.arakelian.faker.model.Personinstance.ImmutablePerson.Builderfrom(com.arakelian.store.feature.HasId instance)Fill a builder with attribute values from the providedcom.arakelian.store.feature.HasIdinstance.ImmutablePerson.Builderfrom(com.arakelian.store.feature.HasTimestamp instance)Fill a builder with attribute values from the providedcom.arakelian.store.feature.HasTimestampinstance.ImmutablePerson.Buildergender(Gender gender)Initializes the value for thegenderattribute.ImmutablePerson.Builderid(java.lang.String id)Initializes the value for theidattribute.ImmutablePerson.BuilderlastName(java.lang.String lastName)Initializes the value for thelastNameattribute.ImmutablePerson.Builderproperties(java.util.Map<java.lang.String,? extends java.lang.Object> entries)Sets or replaces all mappings from the specified map as entries for thepropertiesmap.ImmutablePerson.BuilderputAllProperties(java.util.Map<java.lang.String,? extends java.lang.Object> entries)Put all mappings from the specified map as entries topropertiesmap.ImmutablePerson.BuilderputProperty(java.lang.String key, java.lang.Object value)Put one entry to thepropertiesmap.ImmutablePerson.BuilderputProperty(java.util.Map.Entry<java.lang.String,? extends java.lang.Object> entry)Put one entry to thepropertiesmap.ImmutablePerson.Buildertitle(java.lang.String title)Initializes the value for thetitleattribute.ImmutablePerson.Builderupdated(java.time.ZonedDateTime updated)Initializes the value for theupdatedattribute.
-
-
-
Method Detail
-
from
@CanIgnoreReturnValue public final ImmutablePerson.Builder from(com.arakelian.store.feature.HasId instance)
Fill a builder with attribute values from the providedcom.arakelian.store.feature.HasIdinstance.- Parameters:
instance- The instance from which to copy values- Returns:
thisbuilder for use in a chained invocation
-
from
@CanIgnoreReturnValue public final ImmutablePerson.Builder from(Person instance)
Fill a builder with attribute values from the providedcom.arakelian.faker.model.Personinstance.- Parameters:
instance- The instance from which to copy values- Returns:
thisbuilder for use in a chained invocation
-
from
@CanIgnoreReturnValue public final ImmutablePerson.Builder from(AbstractModel instance)
Fill a builder with attribute values from the providedcom.arakelian.faker.model.AbstractModelinstance.- Parameters:
instance- The instance from which to copy values- Returns:
thisbuilder for use in a chained invocation
-
from
@CanIgnoreReturnValue public final ImmutablePerson.Builder from(com.arakelian.store.feature.HasTimestamp instance)
Fill a builder with attribute values from the providedcom.arakelian.store.feature.HasTimestampinstance.- Parameters:
instance- The instance from which to copy values- Returns:
thisbuilder for use in a chained invocation
-
created
@CanIgnoreReturnValue public final ImmutablePerson.Builder created(java.time.ZonedDateTime created)
Initializes the value for thecreatedattribute.If not set, this attribute will have a default value as returned by the initializer of
created.- Parameters:
created- The value for created- Returns:
thisbuilder for use in a chained invocation
-
id
@CanIgnoreReturnValue public final ImmutablePerson.Builder id(java.lang.String id)
Initializes the value for theidattribute.If not set, this attribute will have a default value as returned by the initializer of
id.- Parameters:
id- The value for id- Returns:
thisbuilder for use in a chained invocation
-
updated
@CanIgnoreReturnValue public final ImmutablePerson.Builder updated(java.time.ZonedDateTime updated)
Initializes the value for theupdatedattribute.If not set, this attribute will have a default value as returned by the initializer of
updated.- Parameters:
updated- The value for updated- Returns:
thisbuilder for use in a chained invocation
-
age
@CanIgnoreReturnValue public final ImmutablePerson.Builder age(java.lang.Integer age)
Initializes the value for theageattribute.If not set, this attribute will have a default value as returned by the initializer of
age.- Parameters:
age- The value for age (can benull)- Returns:
thisbuilder for use in a chained invocation
-
birthdate
@CanIgnoreReturnValue public final ImmutablePerson.Builder birthdate(java.time.ZonedDateTime birthdate)
Initializes the value for thebirthdateattribute.- Parameters:
birthdate- The value for birthdate (can benull)- Returns:
thisbuilder for use in a chained invocation
-
comments
@CanIgnoreReturnValue public final ImmutablePerson.Builder comments(java.lang.String comments)
Initializes the value for thecommentsattribute.- Parameters:
comments- The value for comments (can benull)- Returns:
thisbuilder for use in a chained invocation
-
firstName
@CanIgnoreReturnValue public final ImmutablePerson.Builder firstName(java.lang.String firstName)
Initializes the value for thefirstNameattribute.- Parameters:
firstName- The value for firstName- Returns:
thisbuilder for use in a chained invocation
-
gender
@CanIgnoreReturnValue public final ImmutablePerson.Builder gender(Gender gender)
Initializes the value for thegenderattribute.- Parameters:
gender- The value for gender (can benull)- Returns:
thisbuilder for use in a chained invocation
-
lastName
@CanIgnoreReturnValue public final ImmutablePerson.Builder lastName(java.lang.String lastName)
Initializes the value for thelastNameattribute.- Parameters:
lastName- The value for lastName- Returns:
thisbuilder for use in a chained invocation
-
putProperty
@CanIgnoreReturnValue public final ImmutablePerson.Builder putProperty(java.lang.String key, java.lang.Object value)
Put one entry to thepropertiesmap.- Parameters:
key- The key in the properties mapvalue- The associated value in the properties map- Returns:
thisbuilder for use in a chained invocation
-
putProperty
@CanIgnoreReturnValue public final ImmutablePerson.Builder putProperty(java.util.Map.Entry<java.lang.String,? extends java.lang.Object> entry)
Put one entry to thepropertiesmap. Nulls are not permitted- Parameters:
entry- The key and value entry- Returns:
thisbuilder for use in a chained invocation
-
properties
@CanIgnoreReturnValue public final ImmutablePerson.Builder properties(java.util.Map<java.lang.String,? extends java.lang.Object> entries)
Sets or replaces all mappings from the specified map as entries for thepropertiesmap. Nulls are not permitted- Parameters:
entries- The entries that will be added to the properties map- Returns:
thisbuilder for use in a chained invocation
-
putAllProperties
@CanIgnoreReturnValue public final ImmutablePerson.Builder putAllProperties(java.util.Map<java.lang.String,? extends java.lang.Object> entries)
Put all mappings from the specified map as entries topropertiesmap. Nulls are not permitted- Parameters:
entries- The entries that will be added to the properties map- Returns:
thisbuilder for use in a chained invocation
-
title
@CanIgnoreReturnValue public final ImmutablePerson.Builder title(java.lang.String title)
Initializes the value for thetitleattribute.- Parameters:
title- The value for title (can benull)- Returns:
thisbuilder for use in a chained invocation
-
build
public ImmutablePerson build()
Builds a newImmutablePerson.- Returns:
- An immutable instance of Person
- Throws:
java.lang.IllegalStateException- if any required attributes are missing
-
-