Enhance branch object with default flag

This commit is contained in:
René Pfeuffer
2019-03-25 11:28:29 +01:00
parent 5aab95b651
commit 4ec7006108
9 changed files with 26 additions and 10 deletions

View File

@@ -66,7 +66,7 @@ public final class Branch implements Serializable
* This constructor should only be called from JAXB.
*
*/
public Branch() {}
Branch() {}
/**
* Constructs a new branch.
@@ -75,10 +75,19 @@ public final class Branch implements Serializable
* @param name name of the branch
* @param revision latest revision of the branch
*/
public Branch(String name, String revision)
Branch(String name, String revision, boolean defaultBranch)
{
this.name = name;
this.revision = revision;
this.defaultBranch = defaultBranch;
}
public static Branch normalBranch(String name, String revision) {
return new Branch(name, revision, false);
}
public static Branch defaultBranch(String name, String revision) {
return new Branch(name, revision, true);
}
//~--- methods --------------------------------------------------------------
@@ -162,6 +171,10 @@ public final class Branch implements Serializable
return revision;
}
public boolean isDefaultBranch() {
return defaultBranch;
}
//~--- fields ---------------------------------------------------------------
/** name of the branch */
@@ -169,4 +182,6 @@ public final class Branch implements Serializable
/** Field description */
private String revision;
private boolean defaultBranch;
}