63 lines
1.2 KiB
Java
63 lines
1.2 KiB
Java
package org.gcube.data_catalogue.grsf_publish_ws.utils.groups;
|
|
|
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
|
import com.fasterxml.jackson.annotation.JsonValue;
|
|
|
|
|
|
/**
|
|
* Type for Fishery records
|
|
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
|
*/
|
|
public enum Type_Fishery {
|
|
|
|
Fishery_Activity("Fishery Activity"), // for fishery
|
|
Fishing_Description("Fishing Description"); // for fishery
|
|
|
|
private String subGroupNameOrig;
|
|
|
|
private Type_Fishery(String origName) {
|
|
this.subGroupNameOrig = origName;
|
|
}
|
|
|
|
/**
|
|
* Return the original name
|
|
* @return
|
|
*/
|
|
public String getOrigName(){
|
|
return subGroupNameOrig;
|
|
}
|
|
|
|
/**
|
|
* Get the json value
|
|
* @return
|
|
*/
|
|
@JsonValue
|
|
public String onSerialize(){
|
|
return subGroupNameOrig.toLowerCase();
|
|
}
|
|
|
|
/**
|
|
* Get back an enum from json string
|
|
* @param typeString
|
|
* @return
|
|
*/
|
|
@JsonCreator
|
|
public static Type_Fishery onDeserialize(String typeString) {
|
|
if(typeString != null) {
|
|
for(Type_Fishery type : Type_Fishery.values()) {
|
|
if(type.getOrigName().equalsIgnoreCase(typeString.trim()))
|
|
return type;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
/**
|
|
* Used by reflection
|
|
*/
|
|
@Override
|
|
public String toString() {
|
|
return getOrigName();
|
|
}
|
|
}
|