Class ImmutableTreeItem

  • All Implemented Interfaces:
    ShaLink, TreeItem

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

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

    • Method Detail

      • sha

        @Nullable
        public String sha()
        SHA.
        Specified by:
        sha in interface ShaLink
      • url

        @Nullable
        public URI url()
        URL.
        Specified by:
        url in interface ShaLink
      • path

        @Nullable
        public String path()
        The file referenced in the tree.
        Specified by:
        path in interface TreeItem
      • mode

        @Nullable
        public String mode()
        The file mode; one of 100644 for file (blob), 100755 for executable (blob), 040000 for subdirectory (tree), 160000 for submodule (commit), or 120000 for a blob that specifies the path of a symlink.
        Specified by:
        mode in interface TreeItem
      • type

        @Nullable
        public String type()
        Either blob, tree, or commit.
        Specified by:
        type in interface TreeItem
      • size

        @Nullable
        public Long size()
        File size in bytes.
        Specified by:
        size in interface TreeItem
      • withSha

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

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

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

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

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

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

        public boolean equals​(@Nullable
                              Object another)
        This instance is equal to all instances of ImmutableTreeItem 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: sha, url, path, mode, type, size.
        Overrides:
        hashCode in class Object
        Returns:
        hashCode value
      • toString

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

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

        public static ImmutableTreeItem.Builder builder()
        Creates a builder for ImmutableTreeItem.
         ImmutableTreeItem.builder()
            .sha(String | null) // nullable sha
            .url(java.net.URI | null) // nullable url
            .path(String | null) // nullable path
            .mode(String | null) // nullable mode
            .type(String | null) // nullable type
            .size(Long | null) // nullable size
            .build();
         
        Returns:
        A new ImmutableTreeItem builder