All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.targomo.client.api.enums.PolygonIntersectionMode Maven / Gradle / Ivy

The newest version!
/**
 * 
 */
package com.targomo.client.api.enums;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

import java.util.stream.Stream;

/**
 * @author Daniel Gerber
 *
 */
public enum PolygonIntersectionMode {

    AVERAGE("average"),
    UNION("union"),
    INTERSECTION("intersection");

    private String key;

    PolygonIntersectionMode(String key) {
		this.key = key;
	}

	@JsonCreator
	public static PolygonIntersectionMode fromString(String key) {
        return key == null ? null : Stream.of(PolygonIntersectionMode.values())
                .filter( enu -> enu.key.equalsIgnoreCase(key)).findFirst()
                .orElseThrow(() -> new IllegalArgumentException("Invalid " +
                     PolygonIntersectionMode.class.getSimpleName() + " specified: " + key + " doesn't exist"));
	}

    @JsonValue
    public String getKey() {
		return key;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy