Class ImmutableFile

  • All Implemented Interfaces:
    File

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

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

    • Method Detail

      • filename

        @Nullable
        public String filename()
        File name
        Specified by:
        filename in interface File
      • additions

        @Nullable
        public Integer additions()
        Number of added lines
        Specified by:
        additions in interface File
      • deletions

        @Nullable
        public Integer deletions()
        Number of removed lines
        Specified by:
        deletions in interface File
      • changes

        @Nullable
        public Integer changes()
        Numnber of changed lines
        Specified by:
        changes in interface File
      • status

        @Nullable
        public String status()
        File status. E.g added, modified
        Specified by:
        status in interface File
      • rawUrl

        public Optional<URI> rawUrl()
        Raw file content API URL
        Specified by:
        rawUrl in interface File
      • blobUrl

        public Optional<URI> blobUrl()
        Blob file content API URL
        Specified by:
        blobUrl in interface File
      • sha

        public Optional<String> sha()
        Sha that included action taken on the given file
        Specified by:
        sha in interface File
      • withFilename

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

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

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

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

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

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

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

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

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

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

        public final ImmutableFile withPatch​(Optional<String> optional)
        Copy the current immutable object by setting an optional value for the patch 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 patch
        Returns:
        A modified copy of this object
      • withSha

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

        public final ImmutableFile withSha​(Optional<String> optional)
        Copy the current immutable object by setting an optional value for the sha 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 sha
        Returns:
        A modified copy of this object
      • withContentsUrl

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

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

        public boolean equals​(@Nullable
                              Object another)
        This instance is equal to all instances of ImmutableFile 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: filename, additions, deletions, changes, status, rawUrl, blobUrl, patch, sha, contentsUrl.
        Overrides:
        hashCode in class Object
        Returns:
        hashCode value
      • toString

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

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

        public static ImmutableFile.Builder builder()
        Creates a builder for ImmutableFile.
         ImmutableFile.builder()
            .filename(String | null) // nullable filename
            .additions(Integer | null) // nullable additions
            .deletions(Integer | null) // nullable deletions
            .changes(Integer | null) // nullable changes
            .status(String | null) // nullable status
            .rawUrl(java.net.URI) // optional rawUrl
            .blobUrl(java.net.URI) // optional blobUrl
            .patch(String) // optional patch
            .sha(String) // optional sha
            .contentsUrl(java.net.URI) // optional contentsUrl
            .build();
         
        Returns:
        A new ImmutableFile builder