Class RepoProject

  • All Implemented Interfaces:
    java.lang.Comparable<RepoProject>

    public class RepoProject
    extends java.lang.Object
    implements java.lang.Comparable<RepoProject>
    The representation of a repo sub project.
    Since:
    4.0
    See Also:
    git-repo project page
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  RepoProject.CopyFile
      The representation of a copy file configuration.
      static class  RepoProject.LinkFile
      The representation of a link file configuration.
      static class  RepoProject.ReferenceFile
      The representation of a reference file configuration.
    • Constructor Summary

      Constructors 
      Constructor Description
      RepoProject​(java.lang.String name, java.lang.String path, java.lang.String revision, java.lang.String remote, java.lang.String groupsParam)
      Constructor for RepoProject
      RepoProject​(java.lang.String name, java.lang.String path, java.lang.String revision, java.lang.String remote, java.util.Set<java.lang.String> groups, java.lang.String recommendShallow)
      Constructor for RepoProject
    • Field Detail

      • name

        private final java.lang.String name
      • path

        private final java.lang.String path
      • revision

        private final java.lang.String revision
      • remote

        private final java.lang.String remote
      • groups

        private final java.util.Set<java.lang.String> groups
      • recommendShallow

        private java.lang.String recommendShallow
      • url

        private java.lang.String url
      • defaultRevision

        private java.lang.String defaultRevision
    • Constructor Detail

      • RepoProject

        public RepoProject​(java.lang.String name,
                           java.lang.String path,
                           java.lang.String revision,
                           java.lang.String remote,
                           java.util.Set<java.lang.String> groups,
                           java.lang.String recommendShallow)
        Constructor for RepoProject
        Parameters:
        name - the relative path to the remote
        path - the relative path to the super project
        revision - a SHA-1 or branch name or tag name
        remote - name of the remote definition
        groups - set of groups
        recommendShallow - recommendation for shallowness
        Since:
        4.4
      • RepoProject

        public RepoProject​(java.lang.String name,
                           java.lang.String path,
                           java.lang.String revision,
                           java.lang.String remote,
                           java.lang.String groupsParam)
        Constructor for RepoProject
        Parameters:
        name - the relative path to the remote
        path - the relative path to the super project
        revision - a SHA-1 or branch name or tag name
        remote - name of the remote definition
        groupsParam - comma separated group list
    • Method Detail

      • setUrl

        public RepoProject setUrl​(java.lang.String url)
        Set the url of the sub repo.
        Parameters:
        url - project url
        Returns:
        this for chaining.
      • setGroups

        public RepoProject setGroups​(java.lang.String groupsParam)
        Set the url of the sub repo.
        Parameters:
        groupsParam - comma separated group list
        Returns:
        this for chaining.
        Since:
        4.4
      • setDefaultRevision

        public RepoProject setDefaultRevision​(java.lang.String defaultRevision)
        Set the default revision for the sub repo.
        Parameters:
        defaultRevision - the name of the default revision
        Returns:
        this for chaining.
      • getName

        public java.lang.String getName()
        Get the name (relative path to the remote) of this sub repo.
        Returns:
        name
      • getPath

        public java.lang.String getPath()
        Get the path (relative path to the super project) of this sub repo.
        Returns:
        path
      • getRevision

        public java.lang.String getRevision()
        Get the revision of the sub repo.
        Returns:
        revision if set, or defaultRevision.
      • getCopyFiles

        public java.util.List<RepoProject.CopyFile> getCopyFiles()
        Getter for the copyfile configurations.
        Returns:
        Immutable copy of copyfiles
      • getLinkFiles

        public java.util.List<RepoProject.LinkFile> getLinkFiles()
        Getter for the linkfile configurations.
        Returns:
        Immutable copy of linkfiles
        Since:
        4.8
      • getUrl

        public java.lang.String getUrl()
        Get the url of the sub repo.
        Returns:
        url
      • getRemote

        public java.lang.String getRemote()
        Get the name of the remote definition of the sub repo.
        Returns:
        remote
      • inGroup

        public boolean inGroup​(java.lang.String group)
        Test whether this sub repo belongs to a specified group.
        Parameters:
        group - a group
        Returns:
        true if group is present.
      • getGroups

        public java.util.Set<java.lang.String> getGroups()
        Return the set of groups.
        Returns:
        a Set of groups.
        Since:
        4.4
      • getRecommendShallow

        public java.lang.String getRecommendShallow()
        Return the recommendation for shallowness.
        Returns:
        the String of "clone-depth"
        Since:
        4.4
      • setRecommendShallow

        public void setRecommendShallow​(java.lang.String recommendShallow)
        Sets the recommendation for shallowness.
        Parameters:
        recommendShallow - recommendation for shallowness
        Since:
        4.4
      • addCopyFiles

        public void addCopyFiles​(java.util.Collection<RepoProject.CopyFile> copyFiles)
        Add a bunch of copyfile configurations.
        Parameters:
        copyFiles - a collection of RepoProject.CopyFile objects
      • clearCopyFiles

        public void clearCopyFiles()
        Clear all the copyfiles.
        Since:
        4.2
      • addLinkFiles

        public void addLinkFiles​(java.util.Collection<RepoProject.LinkFile> linkFiles)
        Add a bunch of linkfile configurations.
        Parameters:
        linkFiles - a collection of RepoProject.LinkFiles
        Since:
        4.8
      • clearLinkFiles

        public void clearLinkFiles()
        Clear all the linkfiles.
        Since:
        4.8
      • getPathWithSlash

        private java.lang.String getPathWithSlash()
      • isAncestorOf

        public boolean isAncestorOf​(RepoProject that)
        Check if this sub repo is the ancestor of given sub repo.
        Parameters:
        that - non null
        Returns:
        true if this sub repo is the ancestor of given sub repo.
      • isAncestorOf

        public boolean isAncestorOf​(java.lang.String thatPath)
        Check if this sub repo is an ancestor of the given path.
        Parameters:
        thatPath - path to be checked to see if it is within this repository
        Returns:
        true if this sub repo is an ancestor of the given path.
        Since:
        4.2
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • compareTo

        public int compareTo​(RepoProject that)
        Specified by:
        compareTo in interface java.lang.Comparable<RepoProject>