public static void setProvince(AreaInfo areaInfo, List<Area> allAreas) { if (areaInfo.getAreaLevel() >= areaInfo.LEVEL_ONE) { Area parentArea = getAreaByAreaCode(areaInfo.getAreaCode().substring(0, 2), allAreas); if (parentArea != null) { areaInfo.setProvince(parentArea.getName()); } } }
public static void setDistrict(AreaInfo areaInfo, List<Area> allAreas) { if (areaInfo.getAreaLevel() == areaInfo.LEVEL_THREE) { Area area = getAreaByAreaCode(areaInfo.getAreaCode(), allAreas); if (area != null) { areaInfo.setDistrict(area.getName()); } } setCity(areaInfo, allAreas); }
public static void setCity(AreaInfo areaInfo, List<Area> allAreas) { if (areaInfo.getAreaLevel() >= areaInfo.LEVEL_TWO) { Area area = getAreaByAreaCode(areaInfo.getAreaCode().substring(0, 4), allAreas); if (area != null) { areaInfo.setCity(area.getName()); } } setProvince(areaInfo, allAreas); }