Package forgottentowns.mod.api
Record Class HousingPolicy
java.lang.Object
java.lang.Record
forgottentowns.mod.api.HousingPolicy
- Record Components:
zoneIds- exact zone definition IDs affected by the policyhouseholdOnly- whether additional occupants must share a nonempty household identityallowSoldiers- whether affected homes may admit soldiers; household-only policies also require household membership
public record HousingPolicy(Set<String> zoneIds, boolean householdOnly, boolean allowSoldiers)
extends Record
Optional expansion of ordinary single-occupant housing, bounded by usable beds.
Multiple policies compose additively; an unrestricted policy may also admit unrelated residents.
-
Constructor Summary
ConstructorsConstructorDescriptionHousingPolicy(Set<String> zoneIds, boolean householdOnly, boolean allowSoldiers) Copies and validates the affected zone IDs. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the value of theallowSoldiersrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanReturns the value of thehouseholdOnlyrecord component.final StringtoString()Returns a string representation of this record class.zoneIds()Returns the value of thezoneIdsrecord component.
-
Constructor Details
-
HousingPolicy
Copies and validates the affected zone IDs. The constructor checks nonblank spelling; the registration context separately restricts these IDs to the host's supported housing categories.- Parameters:
zoneIds- nonempty set of stable zone IDshouseholdOnly- require a shared household for additional occupantsallowSoldiers- admit soldiers, requiring household membership only for household-only policies- Throws:
NullPointerException- if zoneIds or an element is nullIllegalArgumentException- if the set is empty or contains a blank ID
-
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
zoneIds
Returns the value of thezoneIdsrecord component.- Returns:
- the value of the
zoneIdsrecord component
-
householdOnly
public boolean householdOnly()Returns the value of thehouseholdOnlyrecord component.- Returns:
- the value of the
householdOnlyrecord component
-
allowSoldiers
public boolean allowSoldiers()Returns the value of theallowSoldiersrecord component.- Returns:
- the value of the
allowSoldiersrecord component
-