Class Percentage
java.lang.Object
de.hybris.order.calculation.money.AbstractAmount
de.hybris.order.calculation.money.Percentage
Represents a relative amount to be used inside the calculation framework.
Provides common operations like
add(Percentage) and subtract(Percentage).
Besides there are some utility methods to ease working with that class: sum(Collection) and
split(int).-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Percentagestatic final Percentagestatic final Percentagestatic final Percentagestatic final Percentagestatic final Percentagestatic final Percentagestatic final Percentagestatic final Percentagestatic final Percentagestatic final Percentagestatic final Percentagestatic final Percentage -
Constructor Summary
ConstructorsConstructorDescriptionPercentage(int rate) Creates a new percentage with the specified rate.Percentage(String rate) Creates a new percentage with the specified rate.Percentage(BigDecimal rate) Creates a new percentage with the specified rate. -
Method Summary
Modifier and TypeMethodDescriptionadd(Percentage percentage) Adds a percentage to current and returns the sum as new object.booleangetRate()Returns the percentage rate.inthashCode()split(int parts) Splits this percentage into the specified number of parts.subtract(Percentage percentage) Subtracts a percentage to current and returns the result as new object.static final Percentagesum(Percentage... percent) Sums a list of percentages.static final Percentagesum(Collection<Percentage> elements) Sums a list of percentages.toString()static List<Percentage>valueOf(int... rates) Creates a list percentages from the given int values.static List<Percentage>Creates a list percentages from the given String values.static List<Percentage>valueOf(BigDecimal... rates) Creates a list percentages from the given BigDecimal values.
-
Field Details
-
ZERO
-
TEN
-
TWENTY
-
TWENTYFIVE
-
THIRTY
-
FOURTY
-
FIFTY
-
SIXTY
-
SEVENTY
-
SEVENTYFIVE
-
EIGHTY
-
NINETY
-
HUNDRED
-
-
Constructor Details
-
Percentage
Creates a new percentage with the specified rate. -
Percentage
public Percentage(int rate) Creates a new percentage with the specified rate. -
Percentage
Creates a new percentage with the specified rate.
-
-
Method Details
-
valueOf
Creates a list percentages from the given String values. -
valueOf
Creates a list percentages from the given int values. -
valueOf
Creates a list percentages from the given BigDecimal values. -
getRate
Returns the percentage rate. -
add
Adds a percentage to current and returns the sum as new object. -
subtract
Subtracts a percentage to current and returns the result as new object. -
hashCode
public int hashCode() -
equals
-
toString
- Overrides:
toStringin classAbstractAmount
-
sum
Sums a list of percentages. -
sum
Sums a list of percentages. -
split
Splits this percentage into the specified number of parts.
-