java.lang.Object
de.powerstat.validation.values.Percent
- All Implemented Interfaces:
IValueObject
,Comparable<Percent>
Percent 0-100.
Not DSGVO relevant.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
Compare with another object.boolean
Is equal with another object.int
hashCode()
Calculate hash code.int
intValue()
Returns the value of this Percent as an int.static Percent
of
(int percent) Percent factory.static Percent
Percent factory.Returns the value of this Percent as an String.toString()
Returns the string representation of this Percent.
-
Field Details
-
percent
private final int percentPercent.
-
-
Constructor Details
-
Percent
private Percent(int percent) Constructor.- Parameters:
percent
- Percent 0-100- Throws:
IndexOutOfBoundsException
- When the percent is less than 0 or greater than 100
-
-
Method Details
-
of
Percent factory.- Parameters:
percent
- Percent 0-100- Returns:
- Percent object
-
of
Percent factory.- Parameters:
percent
- Percent 0-100- Returns:
- Percent object
-
intValue
public int intValue()Returns the value of this Percent as an int.- Returns:
- The numeric value represented by this object after conversion to type int.
-
stringValue
Returns the value of this Percent as an String.- Specified by:
stringValue
in interfaceIValueObject
- Returns:
- The numeric value represented by this object after conversion to type String.
-
hashCode
public int hashCode()Calculate hash code. -
equals
Is equal with another object. -
toString
Returns the string representation of this Percent. The exact details of this representation are unspecified and subject to change, but the following may be regarded as typical: "Percent[percent=0]" -
compareTo
Compare with another object.- Specified by:
compareTo
in interfaceComparable<Percent>
- Parameters:
obj
- Object to compare with- Returns:
- 0: equal; 1: greater; -1: smaller
- See Also:
-