Package javiergs.tulip
Class URLObject
java.lang.Object
javiergs.tulip.URLObject
Represents a GitHub URL object with an owner, repository, revision, path, and kind.
- Version:
- 3.0
- Author:
- javiergs
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe kind of the URL object: ROOT, TREE (directory), or BLOB (file). -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected URLObject.Kindprotected Stringprotected Stringprotected Stringprotected String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanisBlob()Checks if the URL object represents a blob (file).booleanChecks if the URL object represents a directory (tree or root).toString()Returns a readable string representation of this URLObject, including an owner, repository, revision, path, and kind.
-
Field Details
-
owner
-
repository
-
revision
-
path
-
kind
-
-
Constructor Details
-
URLObject
public URLObject(String owner, String repository, String revision, String path, URLObject.Kind kind) Constructs a URLObject with the specified parameters.- Parameters:
owner- the owner of the repositoryrepository- the name of the repositoryrevision- the revision (branch, tag, or commit) can be nullpath- the path within the repository can be null or empty for rootkind- the kind of the URL object (ROOT, TREE, BLOB)- Throws:
IllegalArgumentException- if the owner or repository is null or blank
-
-
Method Details
-
isBlob
public boolean isBlob()Checks if the URL object represents a blob (file).- Returns:
- true if the kind is BLOB, false otherwise
-
isDirectory
public boolean isDirectory()Checks if the URL object represents a directory (tree or root).- Returns:
- true if the kind is TREE or ROOT, false otherwise
-
toString
Returns a readable string representation of this URLObject, including an owner, repository, revision, path, and kind.
-