M- - The source Metadata type required by this Translator
N- - The destination Metadata type required by this Translator
public abstract class AbstractTranslator<M extends Metadata,N extends Metadata> extends AbstractSCIFIOPlugin implements Translator
NB: this class provides a special abstract method:
typedTranslate(Metadata, Metadata). That is the method which should
be overridden when extending this class, and not
translate(Metadata, Metadata) - which has been set up to translate
the type-general Metadata information, delegate to
and then populate the ImageMetadata of the destination.
|Constructor and Description|
|Modifier and Type||Method and Description|
Uses the source
Use format-specific metadata from the source to populate the destination's format-specific metadata.
Use format-agnostic metadata (
getInfo, getPriority, setInfo, setPriority, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Metadatato populate the destination
Metadata. Specifically, the format-specific metadata and/or
ImageMetadataof the source are used to populate the format- specific metadata of the destination (from which the destination's
ImageMetadatacan be derived}.
Note that the destination does not have to be empty, but can be built up through multiple translations. However each translation step is assumed to overwrite any previously existing data.
For a reference to a fresh
Metadata instance to use in translation,
public void translate(Metadata source, List<ImageMetadata> sourceImgMeta, Metadata dest)
Translator.translate(Metadata, Metadata)with the format-specific and image metadata explicitly split out.
NB: it is NOT GUARANTEED that the
Metadata.getAll() method of the
source here will provide equivalent
ImageMetadata as sourceImgMeta.
For example, if a
MetadataWrapper was used, the two are unlikely to
match up. This is necessary, as
Translator discovery depends on the
format of source and destination, but augmentation via wrapping must affect
protected void typedTranslate(M typedSource, List<ImageMetadata> sourceImgMeta, N typedDest)
ImageMetadata. It is provided with concrete typing for convenience and to limit code duplication.
NB: if this method is just used as a hook to perform some operation
super.typedTranslate should be called at the
end of the method to continue the normal translation process.
protected abstract void translateImageMetadata(List<ImageMetadata> source, N dest)
ImageMetadatato populate the destination's format-specific metadata.
This method must be implemented by every AbstractTranslator subclass, as it covers the general case - agnostic of the source.
Copyright © 2015–2017 SCIFIO. All rights reserved.