Coverage Report - org.webslinger.ext.image.ImageBoxTTLObject
 
Classes in this File Line Coverage Branch Coverage Complexity
ImageBoxTTLObject
0%
0/10
0%
0/1
0
 
 1  
 package org.webslinger.ext.image;
 2  
 
 3  
 import java.awt.Rectangle;
 4  
 import java.io.File;
 5  
 import java.io.IOException;
 6  
 
 7  
 import org.webslinger.util.GeneratedResult;
 8  
 import org.webslinger.util.TTLCachedObject;
 9  
 import org.webslinger.util.TTLObject;
 10  
 
 11  0
 public final class ImageBoxTTLObject extends TTLCachedObject<Rectangle> {
 12  
     static {
 13  0
         TTLObject.setDefaultTTLForClass(ImageBoxTTLObject.class, 1000);
 14  0
     }
 15  
 
 16  
     private final File file;
 17  
 
 18  0
     public ImageBoxTTLObject(File file) {
 19  0
         this.file = file;
 20  0
     }
 21  
 
 22  
     protected long getTimestamp(Rectangle old) throws IOException {
 23  0
         return file.exists() ? file.lastModified() : NOT_EXISTANT_TIMESTAMP;
 24  
     }
 25  
 
 26  
     protected GeneratedResult<Rectangle> generate(Rectangle old) throws IOException {
 27  
         try {
 28  0
             return new GeneratedResult<Rectangle>(file.lastModified(), ImageUtils.getImageBox(file));
 29  0
         } catch (InterruptedException e) {
 30  0
             throw (IOException) new IOException(e.getMessage()).initCause(e);
 31  
         }
 32  
     }
 33  
 }