Interface InputTranslatable

  • All Superinterfaces:
    EntityProvider, Formats, Inputable, Sampleable

    public interface InputTranslatable
    extends Inputable
    Allows this entity to define the way to translate data for a reference into an entity object depending on the format requested, if you just want to use the internal methods to handle formatting the input into an entity then simply use Inputable
    NOTE: throwing FormatUnsupportedException will pass control over to the internal handlers for formatting, if you want to stop the request for this format type entirely then throw an IllegalStateException and the processing will be halted
    Author:
    Aaron Zeckoski (aaron@caret.cam.ac.uk)
    • Method Detail

      • translateFormattedData

        Object translateFormattedData​(EntityReference ref,
                                      String format,
                                      InputStream input,
                                      Map<String,​Object> params)
        Translates the input data stream in the supplied format into an entity object for this reference
        Parameters:
        ref - the parsed reference object which uniquely represents this entity
        format - a string constant indicating the extension format (from Formats) of the input, (example: Formats.XML)
        input - an stream which contains the data to make up this entity, you may assume this is UTF-8 encoded if you don't know anything else about it
        params - (optional) incoming set of parameters which may be used to send data specific to this request, may be null
        Returns:
        an entity object of the type used for these entities
        Throws:
        FormatUnsupportedException - if you do not handle this format type (passes control to the internal handlers)
        EntityEncodingException - if you cannot encode the received data into an entity
        IllegalArgumentException - if any of the arguments are invalid
        IllegalStateException - for all other failures