/
javapractice
/
JavaPractice
Обзор
Документация
Войти
/
javapractice
/
JavaPractice
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
2
CI/CD
Аналитика
develop
ApachePOI/src/main/java/entities/Allocation.java
63 строки
2 KB
Zexa91x0
Apache POI - XLSXSave
24 май 2021, 18:47
24 май 2021, 18:47
6bf1dfc
Код
Авторство
О чём код?
package entities; import org.jetbrains.annotations.NotNull; import java.util.List; public class Allocation implements Comparable<Allocation> { private List<Owner> ownersList; private CellPhone cellPhone; private Double amount; public Allocation(@NotNull List<Owner> ownersList, @NotNull CellPhone cellPhone) { if ((ownersList == null) || (ownersList == null)) throw new IllegalArgumentException("поля 'пользователи' и 'телефон' должны быть заполнены корректными данными"); this.ownersList = ownersList; this.cellPhone = cellPhone; } public Allocation(@NotNull List<Owner> ownersList, @NotNull CellPhone cellPhone, Double amount) { if ((ownersList == null) || (ownersList == null)) throw new IllegalArgumentException("поля 'пользователи' и 'телефон' должны быть заполнены корректными данными"); this.ownersList = ownersList; this.cellPhone = cellPhone; this.amount = amount; } public List<Owner> getOwnersList() { return ownersList; } public void setOwnersList(@NotNull List<Owner> ownersList) { this.ownersList = ownersList; } public CellPhone getCellPhone() { return cellPhone; } public Allocation setCellPhone(CellPhone cellPhone) { this.cellPhone = cellPhone; return this; } public Double getAmount() { return amount; } public Allocation setAmount(Double amount) { this.amount = amount; return this; } @Override public String toString() { return cellPhone + " " + ownersList + ((amount == null) ? ("") : (" " + amount)); } public int compareTo(@NotNull Allocation o) { return this.getCellPhone().getNumber().compareTo(o.getCellPhone().getNumber()); } }