Package org.vx68k.bitbucket.api.client
Class BitbucketClientRepository
- java.lang.Object
-
- org.vx68k.bitbucket.api.client.BitbucketClientObject
-
- org.vx68k.bitbucket.api.client.BitbucketClientRepository
-
- All Implemented Interfaces:
BitbucketIssueTracker
,BitbucketRepository
public class BitbucketClientRepository extends BitbucketClientObject implements BitbucketRepository, BitbucketIssueTracker
Client implementation ofBitbucketRepository
. This class represents a repository by a JSON object.- Since:
- 5.0
- Author:
- Kaz Nishimura
-
-
Field Summary
-
Fields inherited from interface org.vx68k.bitbucket.api.BitbucketRepository
GIT, HG
-
-
Constructor Summary
Constructors Constructor Description BitbucketClientRepository(JsonObject object)
Constructs this object.BitbucketClientRepository(JsonObject object, BitbucketClient client)
Constructs this object with a Bitbucket client.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Function<JsonObject,BitbucketClientRepository>
creator()
Returns a function to create a repository from a JSON object.static Function<JsonObject,BitbucketClientRepository>
creator(BitbucketClient bitbucketClient)
Returns a function to create a repository from a JSON object.Instant
getCreated()
Returns the time when the repository was created.String
getDescription()
Returns the description of the repository.String
getFullName()
Returns the full name of the repository.BitbucketIssue
getIssue(int id)
Returns the issue specified by an identifier.BitbucketIssueTracker
getIssueTracker()
Returns the issue tracker of the repository.BitbucketBranch
getMainBranch()
Returns the main branch of the repository.String
getName()
Returns the name of the repository.BitbucketAccount
getOwner()
Returns the owner of the repository.BitbucketRepository
getRepository()
Returns the repository of the issue tracker.String
getSCM()
Returns the SCM type of the repository.long
getSize()
Returns the size of the repository.Instant
getUpdated()
Returns the time when the repository was last updated.UUID
getUUID()
Returns the UUID of the repository.boolean
hasIssueTracker()
Returnstrue
if and only if the repository has a issue tracker.boolean
hasWiki()
Returnstrue
if and only if the repository has a wiki.boolean
isPrivate()
Returnstrue
if and only if the repository is private.Collection<BitbucketIssue>
issues()
Returns a collection view of the issues.Collection<BitbucketIssue>
issues(String filter)
Returns a collection view of the issues that match a filter expression.-
Methods inherited from class org.vx68k.bitbucket.api.client.BitbucketClientObject
equals, getBitbucketClient, getJsonObject, getLink, getType, hashCode, setBitbucketClient, toString
-
-
-
-
Constructor Detail
-
BitbucketClientRepository
public BitbucketClientRepository(JsonObject object)
Constructs this object.- Parameters:
object
- JSON object for a repository- Throws:
IllegalArgumentException
- ifobject
isnull
or is not for a repository
-
BitbucketClientRepository
public BitbucketClientRepository(JsonObject object, BitbucketClient client)
Constructs this object with a Bitbucket client.- Parameters:
object
- JSON object for a repositoryclient
- Bitbucket client- Throws:
IllegalArgumentException
- ifobject
isnull
or is not for a repository
-
-
Method Detail
-
creator
public static Function<JsonObject,BitbucketClientRepository> creator()
Returns a function to create a repository from a JSON object. The returned function initializes the Bitbucket API client of the created repository tonull
.This method can be used to create a
PaginatedList
object.- Returns:
- a function to create a repository from a JSON object
- See Also:
creator(BitbucketClient)
,PaginatedList
-
creator
public static Function<JsonObject,BitbucketClientRepository> creator(BitbucketClient bitbucketClient)
Returns a function to create a repository from a JSON object.This method can be used to create a
PaginatedList
object.- Parameters:
bitbucketClient
- a Bitbucket API client- Returns:
- a function to create a repository from a JSON object
- See Also:
PaginatedList
-
getSCM
public final String getSCM()
Returns the SCM type of the repository. The return value shall be either#GIT
or#HG
.- Specified by:
getSCM
in interfaceBitbucketRepository
- Returns:
- the SCM type of the repository
-
getOwner
public final BitbucketAccount getOwner()
Returns the owner of the repository.- Specified by:
getOwner
in interfaceBitbucketRepository
- Returns:
- the owner of the repository
-
getName
public final String getName()
Returns the name of the repository.- Specified by:
getName
in interfaceBitbucketRepository
- Returns:
- the name of the repository
-
getUUID
public final UUID getUUID()
Returns the UUID of the repository.- Specified by:
getUUID
in interfaceBitbucketRepository
- Returns:
- the UUID of the repository
-
getFullName
public final String getFullName()
Returns the full name of the repository.- Specified by:
getFullName
in interfaceBitbucketRepository
- Returns:
- the full name of the repository
-
getDescription
public final String getDescription()
Returns the description of the repository.This implementation takes the string of
"description"
in the underlying JSON object.- Specified by:
getDescription
in interfaceBitbucketRepository
- Returns:
- the description of the repository
-
isPrivate
public final boolean isPrivate()
Returnstrue
if and only if the repository is private.- Specified by:
isPrivate
in interfaceBitbucketRepository
- Returns:
true
if and only if the repository is private
-
getMainBranch
public final BitbucketBranch getMainBranch()
Returns the main branch of the repository.This implementation takes the object of
"mainbranch"
in the underlying JSON object.- Specified by:
getMainBranch
in interfaceBitbucketRepository
- Returns:
- the main branch of the repository
-
hasIssueTracker
public final boolean hasIssueTracker()
Description copied from interface:BitbucketRepository
Returnstrue
if and only if the repository has a issue tracker.- Specified by:
hasIssueTracker
in interfaceBitbucketRepository
- Returns:
true
if and only if the repository has a issue tracker
-
hasWiki
public final boolean hasWiki()
Description copied from interface:BitbucketRepository
Returnstrue
if and only if the repository has a wiki.- Specified by:
hasWiki
in interfaceBitbucketRepository
- Returns:
true
if and only if the repository has a wiki
-
getSize
public final long getSize()
Description copied from interface:BitbucketRepository
Returns the size of the repository.- Specified by:
getSize
in interfaceBitbucketRepository
- Returns:
- the size of the repository
-
getCreated
public final Instant getCreated()
Returns the time when the repository was created.This implementation takes the date-time value of
"created_on"
in the underlying JSON object.- Specified by:
getCreated
in interfaceBitbucketRepository
- Returns:
- the time when the repository was created
-
getUpdated
public final Instant getUpdated()
Returns the time when the repository was last updated.This implementation takes the date-time value of
"updated_on"
in the underlying JSON object.- Specified by:
getUpdated
in interfaceBitbucketRepository
- Returns:
- the time when the repository was last updated
-
getIssueTracker
public final BitbucketIssueTracker getIssueTracker()
Description copied from interface:BitbucketRepository
Returns the issue tracker of the repository.- Specified by:
getIssueTracker
in interfaceBitbucketRepository
- Returns:
- the issue tracker of the repository
-
getRepository
public final BitbucketRepository getRepository()
Description copied from interface:BitbucketIssueTracker
Returns the repository of the issue tracker.- Specified by:
getRepository
in interfaceBitbucketIssueTracker
- Returns:
- the repository of the issue tracker
-
getIssue
public final BitbucketIssue getIssue(int id)
Returns the issue specified by an identifier.- Specified by:
getIssue
in interfaceBitbucketIssueTracker
- Parameters:
id
- identifier of the issue- Returns:
- issue if found,
null
otherwise
-
issues
public final Collection<BitbucketIssue> issues()
Returns a collection view of the issues. The order of the returned issues are unspecified.- Specified by:
issues
in interfaceBitbucketIssueTracker
- Returns:
- a
Collection
view of the issues
-
issues
public final Collection<BitbucketIssue> issues(String filter)
Description copied from interface:BitbucketIssueTracker
Returns a collection view of the issues that match a filter expression. The order of the returned issues are unspecified.- Specified by:
issues
in interfaceBitbucketIssueTracker
- Parameters:
filter
- a filter expression- Returns:
- a
Collection
view of the issues
-
-