Package jenkins.branch
Class Branch
- java.lang.Object
-
- jenkins.branch.Branch
-
- Direct Known Subclasses:
Branch.Dead
@ExportedBean public class Branch extends Object
A source code branch. Not to be subclassed outside this plugin.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Branch.Dead
Represents a dead branch.static class
Branch.TransientJobActionsFactoryImpl
Ensures that thegetActions()
are always present in theActionable.getAllActions()
.
-
Constructor Summary
Constructors Constructor Description Branch(String sourceId, jenkins.scm.api.SCMHead head, SCM scm, List<? extends BranchProperty> properties)
Constructs a branch instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
<T extends Action>
TgetAction(Class<T> clazz)
Gets the specific action, or null if no such property is found.List<Action>
getActions()
Gets all the actions.String
getEncodedName()
Gets a branch name suitable for use in paths.jenkins.scm.api.SCMHead
getHead()
Returns theof the branch
String
getName()
Returns the name of the branch.List<BranchProperty>
getProperties()
Gets all the properties.<T extends BranchProperty>
TgetProperty(Class<T> clazz)
Gets the specific property, ornull
if no such property is found.SCM
getScm()
Returns theSCM
for the branch.String
getSourceId()
Returns theSCMSource.getId()
that this branch originates from.int
hashCode()
boolean
hasProperty(Class<? extends BranchProperty> clazz)
Tests if a property of a specific type is present.boolean
isBuildable()
Returnstrue
iff the branch is can be built.
-
-
-
Constructor Detail
-
Branch
public Branch(String sourceId, jenkins.scm.api.SCMHead head, SCM scm, List<? extends BranchProperty> properties)
Constructs a branch instance.- Parameters:
sourceId
- theSCMSource.getId()
head
- the name of the branch.scm
- theSCM
for the branch.properties
- the properties to initiate the branch with.
-
-
Method Detail
-
getSourceId
public String getSourceId()
Returns theSCMSource.getId()
that this branch originates from.- Returns:
- the
SCMSource.getId()
that this branch originates from.
-
getName
public String getName()
Returns the name of the branch.- Returns:
- the name of the branch.
-
getEncodedName
public String getEncodedName()
Gets a branch name suitable for use in paths.- Returns:
getName()
with URL-unsafe characters escaped- Since:
- 0.2-beta-7
-
getHead
@Exported public jenkins.scm.api.SCMHead getHead()
Returns theof the branch
- Returns:
- the
of the branch
-
getScm
@Exported public SCM getScm()
Returns theSCM
for the branch.- Returns:
- the
SCM
for the branch.
-
hasProperty
public boolean hasProperty(Class<? extends BranchProperty> clazz)
Tests if a property of a specific type is present.- Parameters:
clazz
- the specific property type- Returns:
true
if and only if there is a property of the specified type.
-
getProperty
@CheckForNull public <T extends BranchProperty> T getProperty(Class<T> clazz)
Gets the specific property, ornull
if no such property is found.- Type Parameters:
T
- the type of property.- Parameters:
clazz
- the type of property.- Returns:
- the the specific property, or
null
if no such property is found.
-
getProperties
@NonNull @Exported public List<BranchProperty> getProperties()
Gets all the properties.- Returns:
- the properties.
-
getActions
@NonNull @Exported public List<Action> getActions()
Gets all the actions.- Returns:
- all the actions
-
getAction
@CheckForNull public <T extends Action> T getAction(Class<T> clazz)
Gets the specific action, or null if no such property is found.- Type Parameters:
T
- the type of action- Parameters:
clazz
- the type of action.- Returns:
- the first action of the requested type or
null
if no such action is present.
-
isBuildable
public boolean isBuildable()
Returnstrue
iff the branch is can be built.- Returns:
true
iff the branch is can be built.
-
-