Package megamek.common.universe
Record Class FactionLeaderData
java.lang.Object
java.lang.Record
megamek.common.universe.FactionLeaderData
- Record Components:
- title- the leader's title (e.g., "Duke", "Commander")
- firstName- the leader's given name
- surname- the leader's surname; may be- null
- honorific- additional information following the leader's name (e.g., "III"); may be- null
- gender- the gender of the leader
- startYear- the first year of the leader's tenure, or- nullif unknown
- endYear- the last year of the leader's tenure, or- nullif unknown
public record FactionLeaderData(String title, String firstName, String surname, String honorific, Gender gender, Integer startYear, Integer endYear)
extends Record
Stores details about a leader of a faction, including name, gender, and years of tenure.
 
This record encapsulates all relevant information about an individual who has led a given faction, such as their title, full name, gender, period in office, and any additional honorifics. It also provides utility methods for constructing full display titles and for validating the leader's tenure for a given year.
- Since:
- 0.50.07
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionendYear()Returns the value of theendYearrecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of thefirstNamerecord component.gender()Returns the value of thegenderrecord component.Returns the full name of the leader, constructed from the first name and surname.getFullTitle(boolean excludeFirstOfTheirName) Constructs and returns the full formal title of the leader.final inthashCode()Returns a hash code value for this object.Returns the value of thehonorificrecord component.booleanisValidInYear(int year) Determines if this leader was in office during the specified year.Returns the value of thestartYearrecord component.surname()Returns the value of thesurnamerecord component.title()Returns the value of thetitlerecord component.final StringtoString()Returns a string representation of this record class.
- 
Constructor Details- 
FactionLeaderDatapublic FactionLeaderData(String title, String firstName, @Nullable String surname, @Nullable String honorific, Gender gender, @Nullable Integer startYear, @Nullable Integer endYear) Compact constructor that replaces anynullsurname or honorific with empty strings, and sets missing years toNO_YEAR.- Parameters:
- title- the leader's title
- firstName- the leader's given name
- surname- the leader's surname; may be- null
- honorific- additional name information; may be- null
- gender- the leader's gender
- startYear- the first year of the leader's tenure; may be- null
- endYear- the last year of the leader's tenure; may be- null
- Since:
- 0.50.07
 
 
- 
- 
Method Details- 
getFullNameReturns the full name of the leader, constructed from the first name and surname.- Returns:
- the full name (first name and surname separated by a space)
- Since:
- 0.50.07
 
- 
getFullTitleConstructs and returns the full formal title of the leader.- Parameters:
- excludeFirstOfTheirName- if true, omits the honorific "I" (used for the first of their name)
- Returns:
- the complete title line for the leader, including honorifics
- Since:
- 0.50.07
 
- 
isValidInYearpublic boolean isValidInYear(int year) Determines if this leader was in office during the specified year.- Parameters:
- year- the year to check for validity
- Returns:
- trueif the year is within the leader's tenure,- falseotherwise
- Since:
- 0.50.07
 
- 
toStringReturns 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.
- 
hashCodepublic 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.
- 
equalsIndicates 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).
- 
titleReturns the value of thetitlerecord component.- Returns:
- the value of the titlerecord component
 
- 
firstNameReturns the value of thefirstNamerecord component.- Returns:
- the value of the firstNamerecord component
 
- 
surnameReturns the value of thesurnamerecord component.- Returns:
- the value of the surnamerecord component
 
- 
honorificReturns the value of thehonorificrecord component.- Returns:
- the value of the honorificrecord component
 
- 
genderReturns the value of thegenderrecord component.- Returns:
- the value of the genderrecord component
 
- 
startYearReturns the value of thestartYearrecord component.- Returns:
- the value of the startYearrecord component
 
- 
endYearReturns the value of theendYearrecord component.- Returns:
- the value of the endYearrecord component
 
 
-