public class Percentage
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
double |
value |
Modifier | Constructor and Description |
---|---|
private |
Percentage(double value) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
int |
hashCode() |
private boolean |
noFractionalPart() |
java.lang.String |
toString() |
static Percentage |
withPercentage(double value)
Creates a new
Percentage . |
public static Percentage withPercentage(double value)
Percentage
.value
- the value of the percentage.Percentage
.java.lang.NullPointerException
- if the given value is null
.java.lang.IllegalArgumentException
- if the given value is negative.public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
private boolean noFractionalPart()