Package org.incenp.obofoundry.sssom.util
Enum SerialisationFormat
- java.lang.Object
-
- java.lang.Enum<SerialisationFormat>
-
- org.incenp.obofoundry.sssom.util.SerialisationFormat
-
- All Implemented Interfaces:
Serializable,Comparable<SerialisationFormat>
public enum SerialisationFormat extends Enum<SerialisationFormat>
Represents a format able to serialise SSSOM data.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description CSVSSSOM/CSV, variant used comma-separated columns.JSONSSSOM/JSON, the other format described in the SSSOM specification.RDF_TURTLERDF/Turtle, a RDF representation of SSSOM objects in the Turtle syntax.TSVSSSOM/TSV, the main format specifically designed to serialise SSSOM mappings.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SerialisationFormatfromExtension(String extension)Gets a serialisation format by its associated filename extension.static SerialisationFormatfromName(String name)Gets a serialisation format by its name (long or short).StringgetExtension()Gets the typical filename extension associated with the format.StringgetName()Gets the user-facing name of the serialisation format.static List<String>getShortNames()Gets a list of all available format short names.StringgetSortName()Gets the short name of the serialisation format.static SerialisationFormatvalueOf(String name)Returns the enum constant of this type with the specified name.static SerialisationFormat[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
TSV
public static final SerialisationFormat TSV
SSSOM/TSV, the main format specifically designed to serialise SSSOM mappings.
-
CSV
public static final SerialisationFormat CSV
SSSOM/CSV, variant used comma-separated columns.
-
JSON
public static final SerialisationFormat JSON
SSSOM/JSON, the other format described in the SSSOM specification.
-
RDF_TURTLE
public static final SerialisationFormat RDF_TURTLE
RDF/Turtle, a RDF representation of SSSOM objects in the Turtle syntax.
-
-
Method Detail
-
values
public static SerialisationFormat[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (SerialisationFormat c : SerialisationFormat.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static SerialisationFormat valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
getName
public String getName()
Gets the user-facing name of the serialisation format.That name is suitable, e.g. for display in graphical interfaces.
- Returns:
- The format name.
-
getSortName
public String getSortName()
Gets the short name of the serialisation format.That name is suitable, e.g. for selecting the format in a command-line option.
- Returns:
- The format short name.
-
getExtension
public String getExtension()
Gets the typical filename extension associated with the format.- Returns:
- The format filename extension.
-
getShortNames
public static List<String> getShortNames()
Gets a list of all available format short names.- Returns:
- The available formats, as a list of short names.
-
fromName
public static SerialisationFormat fromName(String name)
Gets a serialisation format by its name (long or short).- Parameters:
name- The name of the format. It can be either the user-facing name (as returned bygetName()) or the short name (as returned bygetShortNames()).- Returns:
- The serialisation format, or
nullif the given name does not match any known format.
-
fromExtension
public static SerialisationFormat fromExtension(String extension)
Gets a serialisation format by its associated filename extension.- Parameters:
extension- The filename extension (not including the initial dot).- Returns:
- The serialisation format, or
nullif the given extension does not match any extension associated with a known format.
-
-