Package com.spotify.github.v3.git
Class ImmutableTreeItem
- java.lang.Object
-
- com.spotify.github.v3.git.ImmutableTreeItem
-
@ParametersAreNonnullByDefault @Generated("org.immutables.processor.ProxyProcessor") @Immutable @CheckReturnValue public final class ImmutableTreeItem extends Object implements TreeItem
Immutable implementation ofTreeItem.Use the builder to create immutable instances:
ImmutableTreeItem.builder().
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classImmutableTreeItem.BuilderBuilds instances of typeImmutableTreeItem.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ImmutableTreeItem.Builderbuilder()Creates a builder forImmutableTreeItem.static ImmutableTreeItemcopyOf(TreeItem instance)Creates an immutable copy of aTreeItemvalue.booleanequals(Object another)This instance is equal to all instances ofImmutableTreeItemthat have equal attribute values.inthashCode()Computes a hash code from attributes:sha,url,path,mode,type,size.Stringmode()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.Stringpath()The file referenced in the tree.Stringsha()SHA.Longsize()File size in bytes.StringtoString()Prints the immutable valueTreeItemwith attribute values.Stringtype()Either blob, tree, or commit.URIurl()URL.ImmutableTreeItemwithMode(String value)Copy the current immutable object by setting a value for themodeattribute.ImmutableTreeItemwithPath(String value)Copy the current immutable object by setting a value for thepathattribute.ImmutableTreeItemwithSha(String value)Copy the current immutable object by setting a value for theshaattribute.ImmutableTreeItemwithSize(Long value)Copy the current immutable object by setting a value for thesizeattribute.ImmutableTreeItemwithType(String value)Copy the current immutable object by setting a value for thetypeattribute.ImmutableTreeItemwithUrl(URI value)Copy the current immutable object by setting a value for theurlattribute.
-
-
-
Method Detail
-
path
@Nullable public String path()
The file referenced in the tree.
-
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.
-
type
@Nullable public String type()
Either blob, tree, or commit.
-
withSha
public final ImmutableTreeItem withSha(@Nullable String value)
Copy the current immutable object by setting a value for theshaattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for sha (can benull)- Returns:
- A modified copy of the
thisobject
-
withUrl
public final ImmutableTreeItem withUrl(@Nullable URI value)
Copy the current immutable object by setting a value for theurlattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for url (can benull)- Returns:
- A modified copy of the
thisobject
-
withPath
public final ImmutableTreeItem withPath(@Nullable String value)
Copy the current immutable object by setting a value for thepathattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for path (can benull)- Returns:
- A modified copy of the
thisobject
-
withMode
public final ImmutableTreeItem withMode(@Nullable String value)
Copy the current immutable object by setting a value for themodeattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for mode (can benull)- Returns:
- A modified copy of the
thisobject
-
withType
public final ImmutableTreeItem withType(@Nullable String value)
Copy the current immutable object by setting a value for thetypeattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for type (can benull)- Returns:
- A modified copy of the
thisobject
-
withSize
public final ImmutableTreeItem withSize(@Nullable Long value)
Copy the current immutable object by setting a value for thesizeattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for size (can benull)- Returns:
- A modified copy of the
thisobject
-
equals
public boolean equals(@Nullable Object another)This instance is equal to all instances ofImmutableTreeItemthat have equal attribute values.
-
hashCode
public int hashCode()
Computes a hash code from attributes:sha,url,path,mode,type,size.
-
toString
public String toString()
Prints the immutable valueTreeItemwith attribute values.
-
copyOf
public static ImmutableTreeItem copyOf(TreeItem instance)
Creates an immutable copy of aTreeItemvalue. 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 forImmutableTreeItem.ImmutableTreeItem.builder() .sha(String | null) // nullablesha.url(java.net.URI | null) // nullableurl.path(String | null) // nullablepath.mode(String | null) // nullablemode.type(String | null) // nullabletype.size(Long | null) // nullablesize.build();- Returns:
- A new ImmutableTreeItem builder
-
-