
ru.sms_activate.response.api_rent.SMSActivateGetRentListResponse Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of SMSActivateApi Show documentation
Show all versions of SMSActivateApi Show documentation
Lib for working with sms activate API.
package ru.sms_activate.response.api_rent;
import ru.sms_activate.error.base.SMSActivateBaseException;
import ru.sms_activate.response.api_rent.extra.SMSActivateRentNumber;
import org.jetbrains.annotations.NotNull;
import java.util.*;
public class SMSActivateGetRentListResponse {
/**
* Map current rents where key is id rent.
*/
private Map values;
private SMSActivateGetRentListResponse() {
}
/**
* Returns the rent by index.
*
* @param rentId index rent.
* @return rent.
* @throws SMSActivateBaseException if index incorrect.
*/
@NotNull
public SMSActivateRentNumber get(int rentId) throws SMSActivateBaseException {
for (SMSActivateRentNumber activateRentNumber : values.values()) {
if (activateRentNumber.getId() == rentId) {
return activateRentNumber;
}
}
throw new SMSActivateBaseException("Rent id is incorrect.", "Некорректный индентификатор аренды.");
}
/**
* Returns the set id rents.
*
* @return set id rents.
*/
@NotNull
public SortedSet getRentSet() {
SortedSet rentIdSet = new TreeSet<>();
for (SMSActivateRentNumber activateRentNumber : values.values()) {
rentIdSet.add(activateRentNumber.getId());
}
return rentIdSet;
}
/**
* Returns the list current rents.
*
* @return the list current rents.
*/
@NotNull
public List getRentNumberList() {
return new ArrayList<>(values.values());
}
@Override
public String toString() {
return "SMSActivateGetRentListResponse{" +
"values=" + values +
'}';
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy