Class Serializers


  • public class Serializers
    extends Object

    Utility class providing helper methods for other serializers.

    Since:
    11/30/17
    Author:
    nilshoffmann
    • Method Detail

      • printAbundanceAssay

        public static String printAbundanceAssay​(de.isas.mztab2.model.Assay a)

        printAbundanceAssay.

        Parameters:
        a - a Assay object.
        Returns:
        a String object.
      • printAbundanceStudyVar

        public static String printAbundanceStudyVar​(de.isas.mztab2.model.StudyVariable sv)

        printAbundanceStudyVar.

        Parameters:
        sv - a StudyVariable object.
        Returns:
        a String object.
      • printAbundanceCoeffVarStudyVar

        public static String printAbundanceCoeffVarStudyVar​(de.isas.mztab2.model.StudyVariable sv)

        printAbundanceCoeffVarStudyVar.

        Parameters:
        sv - a StudyVariable object.
        Returns:
        a String object.
      • printOptColumnMapping

        public static String printOptColumnMapping​(de.isas.mztab2.model.OptColumnMapping ocm)

        printOptColumnMapping.

        Parameters:
        ocm - a OptColumnMapping object.
        Returns:
        a String object.
      • addIndexedLine

        public static <T extends de.isas.mztab2.model.IndexedElement> void addIndexedLine​(com.fasterxml.jackson.core.JsonGenerator jg,
                                                                                          com.fasterxml.jackson.databind.SerializerProvider sp,
                                                                                          String prefix,
                                                                                          Object element,
                                                                                          T indexedElement)

        addIndexedLine for elements like assay[1] that have an id and one additional property element

        Type Parameters:
        T - the type of IndexedElement.
        Parameters:
        jg - a JsonGenerator object.
        sp - a SerializerProvider object.
        prefix - a String object.
        element - a Object object.
        indexedElement - a Parameter object.
      • addIndexedLine

        public static <T extends de.isas.mztab2.model.IndexedElement> void addIndexedLine​(com.fasterxml.jackson.core.JsonGenerator jg,
                                                                                          com.fasterxml.jackson.databind.SerializerProvider sp,
                                                                                          String prefix,
                                                                                          Object element,
                                                                                          List<T> indexedElementList)

        addIndexedLine for elements like assay[1] that have an id and a list of additional property elements

        Type Parameters:
        T - the type of IndexedElement.
        Parameters:
        jg - a JsonGenerator object.
        sp - a SerializerProvider object.
        prefix - a String object.
        element - a Object object.
        indexedElementList - a List object.
      • addLineWithParameters

        public static void addLineWithParameters​(com.fasterxml.jackson.core.JsonGenerator jg,
                                                 String prefix,
                                                 Object element,
                                                 List<de.isas.mztab2.model.Parameter> parameterList)

        addLineWithParameters.

        Parameters:
        jg - a JsonGenerator object.
        prefix - a String object.
        element - a Object object.
        parameterList - a List object.
      • addLineWithPropertyParameters

        public static void addLineWithPropertyParameters​(com.fasterxml.jackson.core.JsonGenerator jg,
                                                         String prefix,
                                                         String propertyName,
                                                         Object element,
                                                         List<de.isas.mztab2.model.Parameter> value)

        addLineWithPropertyParameters.

        Parameters:
        jg - a JsonGenerator object.
        prefix - a String object.
        propertyName - a String object.
        element - a Object object.
        value - a List object.
      • addLineWithNullProperty

        public static void addLineWithNullProperty​(com.fasterxml.jackson.core.JsonGenerator jg,
                                                   String prefix,
                                                   String propertyName,
                                                   Object element)

        addLineWithNullProperty.

        Parameters:
        jg - a JsonGenerator object.
        prefix - a String object.
        propertyName - a String object.
        element - a Object object.
      • addLineWithProperty

        public static void addLineWithProperty​(com.fasterxml.jackson.core.JsonGenerator jg,
                                               String prefix,
                                               String propertyName,
                                               Object element,
                                               Object... value)

        addLineWithProperty.

        Parameters:
        jg - a JsonGenerator object.
        prefix - a String object.
        propertyName - a String object.
        element - a Object object.
        value - a Object object.
      • addLine

        public static void addLine​(com.fasterxml.jackson.core.JsonGenerator jg,
                                   String prefix,
                                   Object element,
                                   Object... value)

        addLine.

        Parameters:
        jg - a JsonGenerator object.
        prefix - a String object.
        element - a Object object.
        value - a Object object.
      • addSubElementStrings

        public static void addSubElementStrings​(com.fasterxml.jackson.core.JsonGenerator jg,
                                                String prefix,
                                                Object element,
                                                String subElementName,
                                                List<?> subElements,
                                                boolean oneLine)

        addSubElementStrings.

        Parameters:
        jg - a JsonGenerator object.
        prefix - a String object.
        element - a Object object.
        subElementName - a String object.
        subElements - a List object.
        oneLine - a boolean.
      • addSubElementParameter

        public static void addSubElementParameter​(com.fasterxml.jackson.core.JsonGenerator jg,
                                                  String prefix,
                                                  Object element,
                                                  String subElementName,
                                                  de.isas.mztab2.model.Parameter subElement)

        addSubElementParameter.

        Parameters:
        jg - a JsonGenerator object.
        prefix - a String object.
        element - a Object object.
        subElementName - a String object.
        subElement - a Parameter object.
      • addSubElementParameters

        public static void addSubElementParameters​(com.fasterxml.jackson.core.JsonGenerator jg,
                                                   String prefix,
                                                   Object element,
                                                   String subElementName,
                                                   List<de.isas.mztab2.model.Parameter> subElements,
                                                   boolean oneLine)

        addSubElementParameters.

        Parameters:
        jg - a JsonGenerator object.
        prefix - a String object.
        element - a Object object.
        subElementName - a String object.
        subElements - a List object.
        oneLine - a boolean.
      • checkForNull

        public static boolean checkForNull​(Object element,
                                           List<?> subElements,
                                           String subElementName)

        checkForNull.

        Parameters:
        element - a Object object.
        subElements - a List object.
        subElementName - a String object.
        Returns:
        a boolean.
      • writeString

        public static void writeString​(String columnName,
                                       com.fasterxml.jackson.core.JsonGenerator jg,
                                       String value)
                                throws IOException

        writeString.

        Parameters:
        columnName - a String object.
        jg - a JsonGenerator object.
        value - a String object.
        Throws:
        IOException - if an operation on the JsonGenerator object fails.
      • writeObject

        public static void writeObject​(String columnName,
                                       com.fasterxml.jackson.core.JsonGenerator jg,
                                       com.fasterxml.jackson.databind.SerializerProvider sp,
                                       Object value)
                                throws IOException

        writeObject.

        Parameters:
        columnName - a String object.
        jg - a JsonGenerator object.
        sp - a SerializerProvider object.
        value - a Object object.
        Throws:
        IOException - if an operation on the JsonGenerator object fails.
      • writeObject

        public static void writeObject​(IMZTabColumn column,
                                       com.fasterxml.jackson.core.JsonGenerator jg,
                                       com.fasterxml.jackson.databind.SerializerProvider sp,
                                       Object value)
                                throws IOException

        writeObject.

        Parameters:
        column - a IMZTabColumn object.
        jg - a JsonGenerator object.
        sp - a SerializerProvider object.
        value - a Object object.
        Throws:
        IOException - if an operation on the JsonGenerator object fails.
      • writeAsNumberArray

        public static void writeAsNumberArray​(IMZTabColumn column,
                                              com.fasterxml.jackson.core.JsonGenerator jg,
                                              List<? extends Number> elements)

        writeAsNumberArray.

        Parameters:
        column - a IMZTabColumn object.
        jg - a JsonGenerator object.
        elements - a List object.
      • writeAsNumberArray

        public static void writeAsNumberArray​(String columnName,
                                              com.fasterxml.jackson.core.JsonGenerator jg,
                                              List<? extends Number> elements)

        writeAsNumberArray.

        Parameters:
        columnName - a String object.
        jg - a JsonGenerator object.
        elements - a List object.
      • writeAsStringArray

        public static void writeAsStringArray​(com.fasterxml.jackson.core.JsonGenerator jg,
                                              List<String> elements)

        writeAsStringArray.

        Parameters:
        jg - a JsonGenerator object.
        elements - a List object.
      • writeAsStringArray

        public static void writeAsStringArray​(String columnName,
                                              com.fasterxml.jackson.core.JsonGenerator jg,
                                              List<String> elements)

        writeAsStringArray.

        Parameters:
        columnName - a String object.
        jg - a JsonGenerator object.
        elements - a List object.
      • writeNumber

        public static void writeNumber​(String columnName,
                                       com.fasterxml.jackson.core.JsonGenerator jg,
                                       Integer value)
                                throws IOException

        writeNumber.

        Parameters:
        columnName - a String object.
        jg - a JsonGenerator object.
        value - a Integer object.
        Throws:
        IOException - if an operation on the JsonGenerator object fails.
      • writeNumber

        public static void writeNumber​(String columnName,
                                       com.fasterxml.jackson.core.JsonGenerator jg,
                                       Double value)
                                throws IOException

        writeNumber.

        Parameters:
        columnName - a String object.
        jg - a JsonGenerator object.
        value - a Double object.
        Throws:
        IOException - if an operation on the JsonGenerator object fails.
      • writeNumber

        public static void writeNumber​(com.fasterxml.jackson.core.JsonGenerator jg,
                                       Integer value)
                                throws IOException

        writeNumber.

        Parameters:
        jg - a JsonGenerator object.
        value - a Integer object.
        Throws:
        IOException - if an operation on the JsonGenerator object fails.
      • writeNumber

        public static void writeNumber​(com.fasterxml.jackson.core.JsonGenerator jg,
                                       Double value)
                                throws IOException

        writeNumber.

        Parameters:
        jg - a JsonGenerator object.
        value - a Double object.
        Throws:
        IOException - if an operation on the JsonGenerator object fails.
      • writeOptColumnMappings

        public static void writeOptColumnMappings​(List<de.isas.mztab2.model.OptColumnMapping> optColumnMappings,
                                                  com.fasterxml.jackson.core.JsonGenerator jg,
                                                  com.fasterxml.jackson.databind.SerializerProvider sp)
                                           throws IOException

        writeOptColumnMappings.

        Parameters:
        optColumnMappings - a List object.
        jg - a JsonGenerator object.
        sp - the serialization provider.
        Throws:
        IOException - if an operation on the JsonGenerator object fails.
      • writeIndexedDoubles

        public static void writeIndexedDoubles​(String prefix,
                                               com.fasterxml.jackson.core.JsonGenerator jg,
                                               List<Double> values)

        writeIndexedValues.

        Parameters:
        prefix - a String object.
        jg - a JsonGenerator object.
        values - a List object.
      • checkIndexedElement

        public static void checkIndexedElement​(de.isas.mztab2.model.IndexedElement element)