// Path: ugeojson-model/src/main/java/org/ugeojson/model/feature/FeatureCollectionDto.java
// public class FeatureCollectionDto extends GeoJSONObjectDto {
//  
// 	private static final long serialVersionUID = 1L;
// 	
// 	private List<FeatureDto> features;
// 
// 	@Override
// 	public GeoJSONObjectTypeEnum getGeoJSONObjectType() {
// 		return GeoJSONObjectTypeEnum.FeatureCollection;
// 	}
// 
// 	public List<FeatureDto> getFeatures() {
// 		return features;
// 	}
// 
// 	public void setFeatures(List<FeatureDto> features) {
// 		this.features = features;
// 	}
// 	
// }
// 
// Path: ugeojson-model/src/main/java/org/ugeojson/model/feature/FeatureDto.java
// public class FeatureDto extends GeoJSONObjectDto {
// 
// 	private static final long serialVersionUID = 1L;
// 
// 	private GeometryDto geometry;
// 	private String properties;
// 	private String id;
// 
// 	@Override
// 	public GeoJSONObjectTypeEnum getGeoJSONObjectType() {
// 		return GeoJSONObjectTypeEnum.Feature;
// 	}
// 
// 	public GeometryDto getGeometry() {
// 		return geometry;
// 	}
// 
// 	public void setGeometry(GeometryDto geometry) {
// 		this.geometry = geometry;
// 	}
// 
// 	public String getProperties() {
// 		return properties;
// 	}
// 
// 	public void setProperties(String properties) {
// 		this.properties = properties;
// 	}
// 
// 	public String getId() {
// 		return id;
// 	}
// 
// 	public void setId(String id) {
// 		this.id = id;
// 	}
// 
// }
// 
// Path: ugeojson-parser/src/main/java/org/ugeojson/parser/util/BoundingBoxParser.java
// public class BoundingBoxParser {
// 
// 	private static final int TWO_DIMENSIONAL_BBOX_LENGTH = 4;
// 
// 	private BoundingBoxParser() {
// 	}
// 
// 	public static BoundingBoxDto parseBbox(JsonObject asJsonObject, JsonDeserializationContext context) {
// 		BoundingBoxDto bboxDto = null;
// 		JsonElement bboxElement = asJsonObject.get("bbox");
// 		if (bboxElement != null) {
// 			double[] bbox = context.deserialize(bboxElement, double[].class);
// 			bboxDto = new BoundingBoxDto();
// 			if (bbox.length == TWO_DIMENSIONAL_BBOX_LENGTH) {
// 				bboxDto.setSouthWestCorner(new PositionDto(bbox[0], bbox[1]));
// 				bboxDto.setNorthEastCorner(new PositionDto(bbox[2], bbox[3]));
// 			} else {
// 				bboxDto.setSouthWestCorner(new PositionDto(bbox[0], bbox[1], bbox[2]));
// 				bboxDto.setNorthEastCorner(new PositionDto(bbox[3], bbox[4], bbox[5]));
// 			}
// 
// 		}
// 		return bboxDto;
// 	}
// 
// }


import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
import org.ugeojson.model.feature.FeatureCollectionDto;
import org.ugeojson.model.feature.FeatureDto;
import org.ugeojson.parser.util.BoundingBoxParser;
import com.google.gson.JsonArray;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
package org.ugeojson.parser.deserializer;




/**
 * Deserializer for FeatureCollection
 * 
 * @author moksuzer
 *
 */
public class FeatureCollectionDeserializer implements JsonDeserializer<FeatureCollectionDto> {

	@Override
	public FeatureCollectionDto deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) {

		FeatureCollectionDto dto = new FeatureCollectionDto();
		List<FeatureDto> features = new ArrayList<>();
		dto.setFeatures(features);

		JsonObject asJsonObject = json.getAsJsonObject();
		JsonArray jsonArray = asJsonObject.get("features").getAsJsonArray();
		if (jsonArray == null) {
			return dto;
		}

		for (int i = 0; i < jsonArray.size(); i++) {
			JsonObject featureElement = jsonArray.get(i).getAsJsonObject();
// Path: ugeojson-model/src/main/java/org/ugeojson/model/feature/FeatureCollectionDto.java
// public class FeatureCollectionDto extends GeoJSONObjectDto {
//  
// 	private static final long serialVersionUID = 1L;
// 	
// 	private List<FeatureDto> features;
// 
// 	@Override
// 	public GeoJSONObjectTypeEnum getGeoJSONObjectType() {
// 		return GeoJSONObjectTypeEnum.FeatureCollection;
// 	}
// 
// 	public List<FeatureDto> getFeatures() {
// 		return features;
// 	}
// 
// 	public void setFeatures(List<FeatureDto> features) {
// 		this.features = features;
// 	}
// 	
// }
// 
// Path: ugeojson-model/src/main/java/org/ugeojson/model/feature/FeatureDto.java
// public class FeatureDto extends GeoJSONObjectDto {
// 
// 	private static final long serialVersionUID = 1L;
// 
// 	private GeometryDto geometry;
// 	private String properties;
// 	private String id;
// 
// 	@Override
// 	public GeoJSONObjectTypeEnum getGeoJSONObjectType() {
// 		return GeoJSONObjectTypeEnum.Feature;
// 	}
// 
// 	public GeometryDto getGeometry() {
// 		return geometry;
// 	}
// 
// 	public void setGeometry(GeometryDto geometry) {
// 		this.geometry = geometry;
// 	}
// 
// 	public String getProperties() {
// 		return properties;
// 	}
// 
// 	public void setProperties(String properties) {
// 		this.properties = properties;
// 	}
// 
// 	public String getId() {
// 		return id;
// 	}
// 
// 	public void setId(String id) {
// 		this.id = id;
// 	}
// 
// }
// 
// Path: ugeojson-parser/src/main/java/org/ugeojson/parser/util/BoundingBoxParser.java
// public class BoundingBoxParser {
// 
// 	private static final int TWO_DIMENSIONAL_BBOX_LENGTH = 4;
// 
// 	private BoundingBoxParser() {
// 	}
// 
// 	public static BoundingBoxDto parseBbox(JsonObject asJsonObject, JsonDeserializationContext context) {
// 		BoundingBoxDto bboxDto = null;
// 		JsonElement bboxElement = asJsonObject.get("bbox");
// 		if (bboxElement != null) {
// 			double[] bbox = context.deserialize(bboxElement, double[].class);
// 			bboxDto = new BoundingBoxDto();
// 			if (bbox.length == TWO_DIMENSIONAL_BBOX_LENGTH) {
// 				bboxDto.setSouthWestCorner(new PositionDto(bbox[0], bbox[1]));
// 				bboxDto.setNorthEastCorner(new PositionDto(bbox[2], bbox[3]));
// 			} else {
// 				bboxDto.setSouthWestCorner(new PositionDto(bbox[0], bbox[1], bbox[2]));
// 				bboxDto.setNorthEastCorner(new PositionDto(bbox[3], bbox[4], bbox[5]));
// 			}
// 
// 		}
// 		return bboxDto;
// 	}
// 
// }


// Path: ugeojson-parser/src/main/java/org/ugeojson/parser/deserializer/FeatureCollectionDeserializer.java
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
import org.ugeojson.model.feature.FeatureCollectionDto;
import org.ugeojson.model.feature.FeatureDto;
import org.ugeojson.parser.util.BoundingBoxParser;
import com.google.gson.JsonArray;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;

package org.ugeojson.parser.deserializer;




/**
 * Deserializer for FeatureCollection
 * 
 * @author moksuzer
 *
 */
public class FeatureCollectionDeserializer implements JsonDeserializer<FeatureCollectionDto> {

	@Override
	public FeatureCollectionDto deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) {

		FeatureCollectionDto dto = new FeatureCollectionDto();
		List<FeatureDto> features = new ArrayList<>();
		dto.setFeatures(features);

		JsonObject asJsonObject = json.getAsJsonObject();
		JsonArray jsonArray = asJsonObject.get("features").getAsJsonArray();
		if (jsonArray == null) {
			return dto;
		}

		for (int i = 0; i < jsonArray.size(); i++) {
			JsonObject featureElement = jsonArray.get(i).getAsJsonObject();
			FeatureDto geometryDto = context.deserialize(featureElement, FeatureDto.class);