package uk.ac.ebi.quickgo.annotation.download.http;

import java.nio.charset.Charset;
import org.springframework.http.MediaType;

/**
 * Hold the definitions of MediaTypes used in downloads, and their components.
 * @author Tony Wardell
 * Date: 27/04/2017
 * Time: 10:38
 * Created with IntelliJ IDEA.
 */
public class MediaTypeFactory {
    private static final String TYPE = "text";
    private static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8");

    public static final String TSV_SUB_TYPE = "tsv";
    public static final String GAF_SUB_TYPE = "gaf";
    public static final String GPAD_SUB_TYPE = "gpad";

    public static final String TSV_MEDIA_TYPE_STRING = TYPE + "/" + TSV_SUB_TYPE;
    public static final String GAF_MEDIA_TYPE_STRING = TYPE + "/" + GAF_SUB_TYPE;
    public static final String GPAD_MEDIA_TYPE_STRING = TYPE + "/" + GPAD_SUB_TYPE;

    public static final MediaType TSV_MEDIA_TYPE = new MediaType(TYPE, TSV_SUB_TYPE, DEFAULT_CHARSET);
    public static final MediaType GAF_MEDIA_TYPE = new MediaType(TYPE, GAF_SUB_TYPE, DEFAULT_CHARSET);
    public static final MediaType GPAD_MEDIA_TYPE = new MediaType(TYPE, GPAD_SUB_TYPE, DEFAULT_CHARSET);
}

@@ -364,16 +364,21 @@
  String 
+TEXT_
 TYPE = %22
@@ -384,16 +384,82 @@
 %22text%22;%0A
+    private static final String APPLICATION_TYPE = %22application%22;%0A
     priv
@@ -688,16 +688,81 @@
  %22gpad%22;
+%0A    private static final String EXCEL_SUB_TYPE = %22vnd.ms-excel%22;
 %0A%0A    pu
@@ -802,32 +802,37 @@
 A_TYPE_STRING = 
+TEXT_
 TYPE + %22/%22 + TSV
@@ -889,32 +889,37 @@
 A_TYPE_STRING = 
+TEXT_
 TYPE + %22/%22 + GAF
@@ -985,16 +985,21 @@
 TRING = 
+TEXT_
 TYPE + %22
@@ -1017,16 +1017,114 @@
 UB_TYPE;
+%0A    public static final String EXCEL_MEDIA_TYPE_STRING = APPLICATION_TYPE + %22/%22 + EXCEL_SUB_TYPE;
 %0A%0A    pu
@@ -1178,24 +1178,29 @@
 w MediaType(
+TEXT_
 TYPE, TSV_SU
@@ -1286,24 +1286,29 @@
 w MediaType(
+TEXT_
 TYPE, GAF_SU
@@ -1399,16 +1399,21 @@
 diaType(
+TEXT_
 TYPE, GP
@@ -1442,11 +1442,131 @@
 HARSET);
+%0A%0A    public static final MediaType EXCEL_MEDIA_TYPE = new MediaType(APPLICATION_TYPE, EXCEL_SUB_TYPE, DEFAULT_CHARSET);
 %0A%7D%0A

Add excel media type, rename some members.