Rev 25503 | Rev 26930 | Go to most recent revision | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed
package com.spice.profitmandi.dao.entity.fofo;import java.util.AbstractMap;import java.util.Arrays;import java.util.List;import java.util.Map;import java.util.stream.Collectors;import java.util.stream.Stream;public enum PartnerType {ALL("All"), PLATINUM("Platinum"), DIAMOND("Diamond"), GOLD("Gold"), SILVER("Silver"), BRONZE("Bronze"),NEW("Rising Star");private static final List<PartnerType> partnerTypes = Arrays.asList(BRONZE, SILVER, GOLD, DIAMOND, PLATINUM);private String value;public static final Map<PartnerType, String> imageMap = Stream.of(new AbstractMap.SimpleEntry<>(PartnerType.GOLD, "resources/images/small_gold.png"), new AbstractMap.SimpleEntry<>(PartnerType.SILVER, "resources/images/small_silver.png"),new AbstractMap.SimpleEntry<>(PartnerType.NEW, "resources/images/small_risingstar.png"), new AbstractMap.SimpleEntry<>(PartnerType.PLATINUM, "resources/images/small_platinum.png"),new AbstractMap.SimpleEntry<>(PartnerType.BRONZE, "resources/images/small_bronze.png"),new AbstractMap.SimpleEntry<>(PartnerType.DIAMOND, "resources/images/small_diamond.png")).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));private PartnerType(String value) {this.value = value;}public String getValue() {return value;}public PartnerType next() {if (this.equals(PartnerType.NEW))return PartnerType.GOLD;int index = partnerTypes.indexOf(this);if (index + 1 == partnerTypes.size()) {return this;} else {return partnerTypes.get(index + 1);}}public PartnerType previous() {int index = partnerTypes.indexOf(this);if (index == 0) {return this;} else {return partnerTypes.get(index + 1);}}}