1   package com.atlassian.bonnie.index;
2   
3   import org.apache.lucene.document.Document;
4   
5   /**
6    * Converts objects to {@link Document}s. Implementations must be thread-safe.
7    */
8   public interface ObjectToDocumentConverter
9   {
10      /**
11       * Converts objects to {@link Document}s.
12       *
13       * @param o       object to be converted
14       * @param context the context in which the object exists. Null if not applicable.
15       * @return Document representing the indexable version of the object
16       */
17      Document convert(Object o, Object context);
18  
19      /**
20       * Given an object, provide a way of uniquely identifying the object from an index.
21       *
22       * @return array of identity field name and identity value
23       */
24      String[] getObjectIdentity(Object o);
25  }