changeset 1647:2184c0ef4b30

new optional per-image hints for DocuImage.
author Robert Casties <casties@mpiwg-berlin.mpg.de>
date Wed, 06 Sep 2017 17:42:20 +0200
parents 8aea51cbf614
children 146c5f619e3c
files common/src/main/java/digilib/image/DocuImage.java common/src/main/java/digilib/image/DocuImageImpl.java
diffstat 2 files changed, 36 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/common/src/main/java/digilib/image/DocuImage.java	Wed Sep 06 17:41:38 2017 +0200
+++ b/common/src/main/java/digilib/image/DocuImage.java	Wed Sep 06 17:42:20 2017 +0200
@@ -318,4 +318,20 @@
      * @param hackString
      */
     public void setHacks(String hackString);
+    
+    /**
+     * Set optional image specific hints with additional information.
+     * 
+     * @param key
+     * @param value
+     */
+    public void setHint(String key, Object value);
+    
+    /**
+     * Returns the image specific hint with the given key.
+     * 
+     * @param key
+     * @return
+     */
+    public Object getHint(String key);
 }
--- a/common/src/main/java/digilib/image/DocuImageImpl.java	Wed Sep 06 17:41:38 2017 +0200
+++ b/common/src/main/java/digilib/image/DocuImageImpl.java	Wed Sep 06 17:42:20 2017 +0200
@@ -33,6 +33,7 @@
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Map;
 
 import org.apache.log4j.Logger;
 
@@ -68,6 +69,9 @@
 
     /** ImageInput that was read */
     protected ImageInput input;
+    
+    /** image specific hints */
+    protected Map<String, Object> hints;
 
     /** 
      * Returns the version.
@@ -228,4 +232,20 @@
         // doing nothing
     }
 
+    /* (non-Javadoc)
+     * @see digilib.image.DocuImage#setHint(java.lang.String, java.lang.Object)
+     */
+    @Override
+    public void setHint(String key, Object value) {
+        hints.put(key, value);        
+    }
+
+    /* (non-Javadoc)
+     * @see digilib.image.DocuImage#getHint(java.lang.String)
+     */
+    @Override
+    public Object getHint(String key) {
+        return hints.get(key);
+    }
+
 }