Class Translator

  • Direct Known Subclasses:
    ItemToObjectTranslator

    public abstract class Translator
    extends java.lang.Object
    Interface specifying operations required for inline translation of queries and data objects by a translating ObjectStore.
    Author:
    Andrew Varley, Mark Woodbridge
    • Constructor Detail

      • Translator

        public Translator()
    • Method Detail

      • setObjectStore

        public void setObjectStore​(ObjectStore os)
        Set this Translator's ObjectStore.
        Parameters:
        os - the ObjectStore
      • translateQuery

        public abstract Query translateQuery​(Query query)
                                      throws ObjectStoreException
        Translate a query.
        Parameters:
        query - the Query to translate
        Returns:
        the translated query
        Throws:
        ObjectStoreException - if the query cannot be translated
      • translateToDbObject

        public abstract java.lang.Object translateToDbObject​(java.lang.Object o)
        Translate an object entering the ObjectStore.
        Parameters:
        o - the Object to translate
        Returns:
        the translated object
      • translateFromDbObject

        public abstract java.lang.Object translateFromDbObject​(java.lang.Object o)
                                                        throws MetaDataException
        Translate an object exiting the ObjectStore.
        Parameters:
        o - the object to translate
        Returns:
        the translated object
        Throws:
        MetaDataException - if item has a field that isn't in InterMine model
      • translateIdToIdentifier

        public abstract java.lang.Object translateIdToIdentifier​(java.lang.Integer id)
        Translate an object id into a native identifier.
        Parameters:
        id - the object id
        Returns:
        an object that represents the underlying object's identifier