public class DefaultFormatInfo extends java.lang.Object implements JPhyloIOFormatInfo
JPhyloIOFormatInfo
.Constructor and Description |
---|
DefaultFormatInfo(SingleReaderWriterFactory factory,
java.lang.String formatID,
java.lang.String formatName,
java.util.Set<EventContentType> supportedReaderContentTypes,
java.util.Set<EventContentType> supportedWriterContentTypes,
java.util.Map<EventContentType,MetadataModeling> supportedReaderMetadataModeling,
java.util.Map<EventContentType,MetadataModeling> supportedWriterMetadataModeling,
java.util.Set<java.lang.String> supportedReaderParameters,
java.util.Set<java.lang.String> supportedWriterParameters,
ReadWriteParameterMap filterParameters,
java.lang.String filterDescription,
java.lang.String... filterExtensions)
Creates a new instance of this class.
|
Modifier and Type | Method and Description |
---|---|
JPhyloIOContentExtensionFileFilter |
createFileFilter(ContentExtensionFileFilter.TestStrategy testStrategy)
Creates a new file filter instance that is associated with the modeled format.
|
java.lang.String |
getFormatID()
Returns a string ID uniquely identifying the target format of this instance.
|
java.lang.String |
getFormatName()
Returns the human readable name of the modeled format.
|
MetadataModeling |
getMetadataModeling(EventContentType parentContentType,
boolean forReading)
Determines which kind of metadata the represented format allows to model nested under the specified data element
Readers will not produce metaevents under an unsupported type, while writers will accept but ignore metaevents under
this type.
|
java.util.Set<java.lang.String> |
getSupportedParameters(boolean forReading)
Returns a set of the parameters supported by the associated reader or writer.
|
boolean |
isElementModeled(EventContentType contentType,
boolean forReading)
Determines whether the represented format allows to model the specified data element (content type).
|
public DefaultFormatInfo(SingleReaderWriterFactory factory, java.lang.String formatID, java.lang.String formatName, java.util.Set<EventContentType> supportedReaderContentTypes, java.util.Set<EventContentType> supportedWriterContentTypes, java.util.Map<EventContentType,MetadataModeling> supportedReaderMetadataModeling, java.util.Map<EventContentType,MetadataModeling> supportedWriterMetadataModeling, java.util.Set<java.lang.String> supportedReaderParameters, java.util.Set<java.lang.String> supportedWriterParameters, ReadWriteParameterMap filterParameters, java.lang.String filterDescription, java.lang.String... filterExtensions)
factory
- the single format factory to be used with this formatformatID
- the ID of the format this information object is aboutformatName
- the name of the format this information object is aboutsupportedReaderContentTypes
- the set of content types supported by the associated reader (If null
is specified,
an empty set is assumed.)supportedWriterContentTypes
- the set of content types supported by the associated writer (If null
is specified,
an empty set is assumed.)supportedMetadata
- the set of content types under which any kind of metadata is supported (If null
is
specified, an empty set is assumed.)supportedReaderParameters
- the set of parameters that are supported by the associated reader (If null
is specified, an empty set is assumed.)supportedWriterParameters
- the set of parameters that are supported by the associated writer (If null
is specified, an empty set is assumed.)filterParameters
- the reader parameters to be used by the file filter to test the contents of a file as they
will be passed to SingleReaderWriterFactory.checkFormat(java.io.InputStream, ReadWriteParameterMap)
filterDescription
- the description of this format to be displayed e.g. in open dialogsfilterExtensions
- the file extension of the associated format (At least one needs to be specified.)java.lang.NullPointerException
- if factory
, formatID
, formatName
, filterDescription
or any element of filterExtensions
is null
java.lang.IllegalArgumentException
- if not at least one extension has been specifiedpublic java.lang.String getFormatID()
JPhyloIOFormatSpecificObject
JPhyloIOReaderWriterFactory.getFormatInfo(String)
.
Third party developers that create readers or writers for additional formats must make sure to use a globally unique
format ID. It is strongly recommended to use owned reverse domain names for this (e.g.
org.example.additionalformat
).
getFormatID
in interface JPhyloIOFormatSpecificObject
JPhyloIOReaderWriterFactory.getFormatInfo(String)
public java.lang.String getFormatName()
JPhyloIOFormatInfo
getFormatName
in interface JPhyloIOFormatInfo
public JPhyloIOContentExtensionFileFilter createFileFilter(ContentExtensionFileFilter.TestStrategy testStrategy)
JPhyloIOFormatInfo
createFileFilter
in interface JPhyloIOFormatInfo
testStrategy
- the strategy to be used to accept a file or notpublic boolean isElementModeled(EventContentType contentType, boolean forReading)
JPhyloIOFormatInfo
Note that the values returned here indicate the capabilities of the provided readers and writers and not the
capabilities of the respective format. It may happen that elements of a format are not supported by its reader and
writer. In such cases false
would be returned here for the according content type.
Note that this method will return true
for content types that may occur at multiple positions in the event stream
(e.g. EventContentType.LITERAL_META
or EventContentType.SET_ELEMENT
), if they are supported at least
at one position. Use #isMetadataModeled(EventContentType)
to check at which position metadata elements are
supported.
isElementModeled
in interface JPhyloIOFormatInfo
contentType
- the content type to be testedforReading
- Specify true
here, if support for contentType
in reading this format or
false
for writing it should be returned.true
if the specified content type is supported, false
otherwise#isMetadataModeled(EventContentType)
public MetadataModeling getMetadataModeling(EventContentType parentContentType, boolean forReading)
JPhyloIOFormatInfo
Note that the values returned here indicate the capabilities of the provided readers and writers and not the capabilities of the respective format.
getMetadataModeling
in interface JPhyloIOFormatInfo
forReading
- Specify true
here, if support for metadata nested under contentType
in reading this
format or false
for writing it should be returned.null
#isElementModeled(EventContentType)
public java.util.Set<java.lang.String> getSupportedParameters(boolean forReading)
JPhyloIOFormatInfo
ReadWriteParameterNames
. Readers
and writers from third party developers may introduce additional parameter names defined elsewhere.getSupportedParameters
in interface JPhyloIOFormatInfo
forReading
- Specify true
here, if support for parameterName
in reading this format or
false
for writing it should be returned.