Class PercentType
java.lang.Object
dev.jcputney.elearning.parser.input.common.PercentType
- All Implemented Interfaces:
Serializable
Represents a percentage value constrained between 0 and 1, inclusive. This type enforces the
range but does not enforce specific decimal precision.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor for the PercentType class.PercentType(BigDecimal value) Constructs a PercentType instance with the specified value. -
Method Summary
Modifier and TypeMethodDescriptionstatic PercentTypeParses a string as a PercentType.toString()Returns the string representation of the percentage value.
-
Constructor Details
-
PercentType
public PercentType()Default constructor for the PercentType class. -
PercentType
Constructs a PercentType instance with the specified value.- Parameters:
value- the decimal value for the percentage must be between 0 and 1.- Throws:
IllegalArgumentException- if the value is out of range.
-
-
Method Details
-
parse
Parses a string as a PercentType.- Parameters:
value- the string representation of the percentage must be a decimal between 0 and 1.- Returns:
- a new PercentType instance.
- Throws:
IllegalArgumentException- if the value is out of range or not a valid decimal format.
-
toString
Returns the string representation of the percentage value.
-