Record Class BranchId
java.lang.Object
java.lang.Record
edu.ucsb.cs156.frontiers.entities.BranchId
@Embeddable
public record BranchId(@Pattern(regexp="^[a-zA-Z0-9._-]+$",message="Invalid org name") @NotNull @NotBlank String org, @Pattern(regexp="^[a-zA-Z0-9._-]+$",message="Invalid repo name") @NotNull @NotBlank String repo, @Pattern(regexp="^[a-zA-Z0-9._-]+$",message="Invalid branch name") @NotNull @NotBlank String branchName)
extends Record
Represents a GitHub branch identifier with organization, repository, and branch name. regex
pattern is specified to prevent injection into GitHub GraphQL API.
-
Constructor Summary
ConstructorsConstructorDescriptionBranchId(@Pattern(regexp="^[a-zA-Z0-9._-]+$",message="Invalid org name") @NotNull @NotBlank String org, @Pattern(regexp="^[a-zA-Z0-9._-]+$",message="Invalid repo name") @NotNull @NotBlank String repo, @Pattern(regexp="^[a-zA-Z0-9._-]+$",message="Invalid branch name") @NotNull @NotBlank String branchName) Creates an instance of aBranchIdrecord class. -
Method Summary
Modifier and TypeMethodDescription@Pattern(regexp="^[a-zA-Z0-9._-]+$",message="Invalid branch name") @NotNull @NotBlank StringReturns the value of thebranchNamerecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.@Pattern(regexp="^[a-zA-Z0-9._-]+$",message="Invalid org name") @NotNull @NotBlank Stringorg()Returns the value of theorgrecord component.@Pattern(regexp="^[a-zA-Z0-9._-]+$",message="Invalid repo name") @NotNull @NotBlank Stringrepo()Returns the value of thereporecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
BranchId
public BranchId(@Pattern(regexp="^[a-zA-Z0-9._-]+$",message="Invalid org name") @NotNull @NotBlank @Pattern(regexp="^[a-zA-Z0-9._-]+$",message="Invalid org name") @NotNull @NotBlank String org, @Pattern(regexp="^[a-zA-Z0-9._-]+$",message="Invalid repo name") @NotNull @NotBlank @Pattern(regexp="^[a-zA-Z0-9._-]+$",message="Invalid repo name") @NotNull @NotBlank String repo, @Pattern(regexp="^[a-zA-Z0-9._-]+$",message="Invalid branch name") @NotNull @NotBlank @Pattern(regexp="^[a-zA-Z0-9._-]+$",message="Invalid branch name") @NotNull @NotBlank String branchName) Creates an instance of aBranchIdrecord class.- Parameters:
org- the value for theorgrecord componentrepo- the value for thereporecord componentbranchName- the value for thebranchNamerecord component
-
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
org
@Pattern(regexp="^[a-zA-Z0-9._-]+$", message="Invalid org name") @NotNull @NotBlank public @Pattern(regexp="^[a-zA-Z0-9._-]+$",message="Invalid org name") @NotNull @NotBlank String org()Returns the value of theorgrecord component.- Returns:
- the value of the
orgrecord component
-
repo
@Pattern(regexp="^[a-zA-Z0-9._-]+$", message="Invalid repo name") @NotNull @NotBlank public @Pattern(regexp="^[a-zA-Z0-9._-]+$",message="Invalid repo name") @NotNull @NotBlank String repo()Returns the value of thereporecord component.- Returns:
- the value of the
reporecord component
-
branchName
@Pattern(regexp="^[a-zA-Z0-9._-]+$", message="Invalid branch name") @NotNull @NotBlank public @Pattern(regexp="^[a-zA-Z0-9._-]+$",message="Invalid branch name") @NotNull @NotBlank String branchName()Returns the value of thebranchNamerecord component.- Returns:
- the value of the
branchNamerecord component
-