Package no.priv.bang.ukelonn.beans
Record Class SumYearMonth
java.lang.Object
java.lang.Record
no.priv.bang.ukelonn.beans.SumYearMonth
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSumYearMonth(double sum, int year, int month) Creates an instance of aSumYearMonthrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intmonth()Returns the value of themonthrecord component.doublesum()Returns the value of thesumrecord component.final StringtoString()Returns a string representation of this record class.static SumYearMonth.Builderwith()intyear()Returns the value of theyearrecord component.
-
Field Details
-
sum
private final double sumThe field for thesumrecord component. -
year
private final int yearThe field for theyearrecord component. -
month
private final int monthThe field for themonthrecord component.
-
-
Constructor Details
-
SumYearMonth
public SumYearMonth(double sum, int year, int month) Creates an instance of aSumYearMonthrecord class.- Parameters:
sum- the value for thesumrecord componentyear- the value for theyearrecord componentmonth- the value for themonthrecord component
-
-
Method Details
-
with
-
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 with '=='. -
sum
public double sum()Returns the value of thesumrecord component.- Returns:
- the value of the
sumrecord component
-
year
public int year()Returns the value of theyearrecord component.- Returns:
- the value of the
yearrecord component
-
month
public int month()Returns the value of themonthrecord component.- Returns:
- the value of the
monthrecord component
-