Class ImmutableBranch

  • All Implemented Interfaces:
    Branch

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

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

    • Method Detail

      • name

        @Nullable
        public String name()
        Branch name
        Specified by:
        name in interface Branch
      • commit

        @Nullable
        public ShaLink commit()
        Commit details branch is labeling
        Specified by:
        commit in interface Branch
      • withName

        public final ImmutableBranch 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
      • withCommit

        public final ImmutableBranch withCommit​(@Nullable
                                                ShaLink value)
        Copy the current immutable object by setting a value for the commit attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for commit (can be null)
        Returns:
        A modified copy of the this object
      • withIsProtected

        public final ImmutableBranch withIsProtected​(boolean value)
        Copy the current immutable object by setting a present value for the optional isProtected attribute.
        Parameters:
        value - The value for isProtected
        Returns:
        A modified copy of this object
      • withIsProtected

        public final ImmutableBranch withIsProtected​(Optional<Boolean> optional)
        Copy the current immutable object by setting an optional value for the isProtected 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 isProtected
        Returns:
        A modified copy of this object
      • withProtectionUrl

        public final ImmutableBranch withProtectionUrl​(URI value)
        Copy the current immutable object by setting a present value for the optional protectionUrl attribute.
        Parameters:
        value - The value for protectionUrl
        Returns:
        A modified copy of this object
      • withProtectionUrl

        public final ImmutableBranch withProtectionUrl​(Optional<? extends URI> optional)
        Copy the current immutable object by setting an optional value for the protectionUrl 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 protectionUrl
        Returns:
        A modified copy of this object
      • equals

        public boolean equals​(@Nullable
                              Object another)
        This instance is equal to all instances of ImmutableBranch 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, commit, isProtected, protectionUrl.
        Overrides:
        hashCode in class Object
        Returns:
        hashCode value
      • toString

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

        public static ImmutableBranch copyOf​(Branch instance)
        Creates an immutable copy of a Branch 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 Branch instance
      • builder

        public static ImmutableBranch.Builder builder()
        Creates a builder for ImmutableBranch.
         ImmutableBranch.builder()
            .name(String | null) // nullable name
            .commit(com.spotify.github.v3.git.ShaLink | null) // nullable commit
            .isProtected(Boolean) // optional isProtected
            .protectionUrl(java.net.URI) // optional protectionUrl
            .build();
         
        Returns:
        A new ImmutableBranch builder