Class ImmutablePerson.Builder

  • Enclosing class:
    ImmutablePerson

    @NotThreadSafe
    public static final class ImmutablePerson.Builder
    extends java.lang.Object
    Builds instances of type ImmutablePerson. Initialize attributes and then invoke the build() method to create an immutable instance.

    Builder is not thread-safe and generally should not be stored in a field or collection, but instead used immediately to create instances.

    • Method Detail

      • from

        @CanIgnoreReturnValue
        public final ImmutablePerson.Builder from​(com.arakelian.store.feature.HasId instance)
        Fill a builder with attribute values from the provided com.arakelian.store.feature.HasId instance.
        Parameters:
        instance - The instance from which to copy values
        Returns:
        this builder for use in a chained invocation
      • from

        @CanIgnoreReturnValue
        public final ImmutablePerson.Builder from​(Person instance)
        Fill a builder with attribute values from the provided com.arakelian.faker.model.Person instance.
        Parameters:
        instance - The instance from which to copy values
        Returns:
        this builder for use in a chained invocation
      • from

        @CanIgnoreReturnValue
        public final ImmutablePerson.Builder from​(AbstractModel instance)
        Fill a builder with attribute values from the provided com.arakelian.faker.model.AbstractModel instance.
        Parameters:
        instance - The instance from which to copy values
        Returns:
        this builder 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 provided com.arakelian.store.feature.HasTimestamp instance.
        Parameters:
        instance - The instance from which to copy values
        Returns:
        this builder for use in a chained invocation
      • created

        @CanIgnoreReturnValue
        public final ImmutablePerson.Builder created​(java.time.ZonedDateTime created)
        Initializes the value for the created attribute.

        If not set, this attribute will have a default value as returned by the initializer of created.

        Parameters:
        created - The value for created
        Returns:
        this builder for use in a chained invocation
      • id

        @CanIgnoreReturnValue
        public final ImmutablePerson.Builder id​(java.lang.String id)
        Initializes the value for the id attribute.

        If not set, this attribute will have a default value as returned by the initializer of id.

        Parameters:
        id - The value for id
        Returns:
        this builder for use in a chained invocation
      • updated

        @CanIgnoreReturnValue
        public final ImmutablePerson.Builder updated​(java.time.ZonedDateTime updated)
        Initializes the value for the updated attribute.

        If not set, this attribute will have a default value as returned by the initializer of updated.

        Parameters:
        updated - The value for updated
        Returns:
        this builder for use in a chained invocation
      • age

        @CanIgnoreReturnValue
        public final ImmutablePerson.Builder age​(java.lang.Integer age)
        Initializes the value for the age attribute.

        If not set, this attribute will have a default value as returned by the initializer of age.

        Parameters:
        age - The value for age (can be null)
        Returns:
        this builder for use in a chained invocation
      • birthdate

        @CanIgnoreReturnValue
        public final ImmutablePerson.Builder birthdate​(java.time.ZonedDateTime birthdate)
        Initializes the value for the birthdate attribute.
        Parameters:
        birthdate - The value for birthdate (can be null)
        Returns:
        this builder for use in a chained invocation
      • comments

        @CanIgnoreReturnValue
        public final ImmutablePerson.Builder comments​(java.lang.String comments)
        Initializes the value for the comments attribute.
        Parameters:
        comments - The value for comments (can be null)
        Returns:
        this builder for use in a chained invocation
      • firstName

        @CanIgnoreReturnValue
        public final ImmutablePerson.Builder firstName​(java.lang.String firstName)
        Initializes the value for the firstName attribute.
        Parameters:
        firstName - The value for firstName
        Returns:
        this builder for use in a chained invocation
      • gender

        @CanIgnoreReturnValue
        public final ImmutablePerson.Builder gender​(Gender gender)
        Initializes the value for the gender attribute.
        Parameters:
        gender - The value for gender (can be null)
        Returns:
        this builder for use in a chained invocation
      • lastName

        @CanIgnoreReturnValue
        public final ImmutablePerson.Builder lastName​(java.lang.String lastName)
        Initializes the value for the lastName attribute.
        Parameters:
        lastName - The value for lastName
        Returns:
        this builder 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 the properties map.
        Parameters:
        key - The key in the properties map
        value - The associated value in the properties map
        Returns:
        this builder 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 the properties map. Nulls are not permitted
        Parameters:
        entry - The key and value entry
        Returns:
        this builder 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 the properties map. Nulls are not permitted
        Parameters:
        entries - The entries that will be added to the properties map
        Returns:
        this builder 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 to properties map. Nulls are not permitted
        Parameters:
        entries - The entries that will be added to the properties map
        Returns:
        this builder for use in a chained invocation
      • title

        @CanIgnoreReturnValue
        public final ImmutablePerson.Builder title​(java.lang.String title)
        Initializes the value for the title attribute.
        Parameters:
        title - The value for title (can be null)
        Returns:
        this builder for use in a chained invocation
      • build

        public ImmutablePerson build()
        Builds a new ImmutablePerson.
        Returns:
        An immutable instance of Person
        Throws:
        java.lang.IllegalStateException - if any required attributes are missing