Klasse Converter

java.lang.Object
org.lifstools.jmzqc.Converter

public class Converter extends Object
Provides convenience functions to parse date and time strings and to serialize and deserialize mzQC from and to a variety of sources.
  • Konstruktordetails

    • Converter

      public Converter()
  • Methodendetails

    • parseDateTimeString

      public static OffsetDateTime parseDateTimeString(String str)
      Parse a date and time string using the default date and time formatter.
      Parameter:
      str - the date time string
      Gibt zurück:
      an OffsetDateTime object.
    • parseTimeString

      public static OffsetTime parseTimeString(String str)
      Parse a time string using the default time formatter.
      Parameter:
      str - the time string
      Gibt zurück:
      an OffsetTime object.
    • of

      public static MzQC of(File file) throws IOException
      Return a Coordinate holding an MzQC object from a file.
      Parameter:
      file - the file containing the mzQC json data.
      Gibt zurück:
      Coordinate holding the MzQC object.
      Löst aus:
      IOException
    • of

      public static MzQC of(URL url) throws IOException
      Return a Coordinate holding an MzQC object from a URL.
      Parameter:
      url - the url from where to load the mzQC json data.
      Gibt zurück:
      Coordinate holding the MzQC object.
      Löst aus:
      IOException
    • of

      public static MzQC of(String json) throws IOException
      Return a Coordinate holding an MzQC object from a string holding the JSON representation of an mzQC data.
      Parameter:
      json - the string containing the mzQC json data.
      Gibt zurück:
      Coordinate holding the MzQC object.
      Löst aus:
      IOException
    • validate

      public static Set<com.networknt.schema.ValidationMessage> validate(String json) throws com.fasterxml.jackson.core.JsonProcessingException
      Validate a mzQC JSON string.
      Parameter:
      json - the mzQC data in JSON format.
      Gibt zurück:
      a set of validation messages.
      Löst aus:
      com.fasterxml.jackson.core.JsonProcessingException - if the JSON is malformed.
    • validate

      public static Set<com.networknt.schema.ValidationMessage> validate(MzQC mzQc) throws com.fasterxml.jackson.core.JsonProcessingException
      Validate a mzQC Object.
      Parameter:
      mzQc - the mzQC object.
      Gibt zurück:
      a set of validation messages.
      Löst aus:
      com.fasterxml.jackson.core.JsonProcessingException - if the JSON is malformed.
    • validate

      public static Set<com.networknt.schema.ValidationMessage> validate(File file) throws com.fasterxml.jackson.core.JsonProcessingException, IOException
      Validate a mzQC JSON file.
      Parameter:
      file - the mzQC data file in JSON format.
      Gibt zurück:
      a set of validation messages.
      Löst aus:
      com.fasterxml.jackson.core.JsonProcessingException - if the JSON is malformed.
      IOException
    • validate

      public static Set<com.networknt.schema.ValidationMessage> validate(URL url) throws com.fasterxml.jackson.core.JsonProcessingException, IOException
      Validate a mzQC JSON URL.
      Parameter:
      url - the url to read mzQC data in JSON format from.
      Gibt zurück:
      a set of validation messages.
      Löst aus:
      com.fasterxml.jackson.core.JsonProcessingException - if the JSON is malformed.
      IOException
    • toJsonString

      public static String toJsonString(MzQC obj) throws com.fasterxml.jackson.core.JsonProcessingException
      Serialize the MzQC object to a JSON string.
      Parameter:
      obj - the MzQC object
      Gibt zurück:
      an (unformatted) JSON string representation.
      Löst aus:
      com.fasterxml.jackson.core.JsonProcessingException
    • toJsonFile

      public static File toJsonFile(MzQC obj, File file) throws com.fasterxml.jackson.core.JsonProcessingException, IOException
      Serialize the MzQC object to a file containing the data as a JSON string.
      Parameter:
      obj - the MzQC object
      file - the file to write to
      Gibt zurück:
      an (unformatted) JSON string representation.
      Löst aus:
      com.fasterxml.jackson.core.JsonProcessingException
      IOException