Class ImmutableAuthor

  • All Implemented Interfaces:
    Author

    @ParametersAreNonnullByDefault
    @Generated("org.immutables.processor.ProxyProcessor")
    @Immutable
    @CheckReturnValue
    public final class ImmutableAuthor
    extends Object
    implements Author
    Immutable implementation of Author.

    Use the builder to create immutable instances: ImmutableAuthor.builder().

    • Method Detail

      • name

        @Nullable
        public String name()
        The name of the author.
        Specified by:
        name in interface Author
      • withName

        public final ImmutableAuthor withName​(@Nullable
                                              String value)
        Copy the current immutable object by setting a value for the name attribute. An equals check used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for name (can be null)
        Returns:
        A modified copy of the this object
      • withEmail

        public final ImmutableAuthor withEmail​(String value)
        Copy the current immutable object by setting a present value for the optional email attribute.
        Parameters:
        value - The value for email
        Returns:
        A modified copy of this object
      • withEmail

        public final ImmutableAuthor withEmail​(Optional<String> optional)
        Copy the current immutable object by setting an optional value for the email attribute. An equality check is used on inner nullable value to prevent copying of the same value by returning this.
        Parameters:
        optional - A value for email
        Returns:
        A modified copy of this object
      • withUsername

        public final ImmutableAuthor withUsername​(String value)
        Copy the current immutable object by setting a present value for the optional username attribute.
        Parameters:
        value - The value for username
        Returns:
        A modified copy of this object
      • withUsername

        public final ImmutableAuthor withUsername​(Optional<String> optional)
        Copy the current immutable object by setting an optional value for the username attribute. An equality check is used on inner nullable value to prevent copying of the same value by returning this.
        Parameters:
        optional - A value for username
        Returns:
        A modified copy of this object
      • withDate

        public final ImmutableAuthor withDate​(GitHubInstant value)
        Copy the current immutable object by setting a present value for the optional date attribute.
        Parameters:
        value - The value for date
        Returns:
        A modified copy of this object
      • withDate

        public final ImmutableAuthor withDate​(Optional<? extends GitHubInstant> optional)
        Copy the current immutable object by setting an optional value for the date attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this.
        Parameters:
        optional - A value for date
        Returns:
        A modified copy of this object
      • equals

        public boolean equals​(@Nullable
                              Object another)
        This instance is equal to all instances of ImmutableAuthor that have equal attribute values.
        Overrides:
        equals in class Object
        Returns:
        true if this is equal to another instance
      • hashCode

        public int hashCode()
        Computes a hash code from attributes: name, email, username, date.
        Overrides:
        hashCode in class Object
        Returns:
        hashCode value
      • toString

        public String toString()
        Prints the immutable value Author with attribute values.
        Overrides:
        toString in class Object
        Returns:
        A string representation of the value
      • copyOf

        public static ImmutableAuthor copyOf​(Author instance)
        Creates an immutable copy of a Author value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
        Parameters:
        instance - The instance to copy
        Returns:
        A copied immutable Author instance
      • builder

        public static ImmutableAuthor.Builder builder()
        Creates a builder for ImmutableAuthor.
         ImmutableAuthor.builder()
            .name(String | null) // nullable name
            .email(String) // optional email
            .username(String) // optional username
            .date(com.spotify.github.GitHubInstant) // optional date
            .build();
         
        Returns:
        A new ImmutableAuthor builder