001 package de.deepamehta.plugins.images; 002 003 import org.codehaus.jettison.json.JSONException; 004 import org.codehaus.jettison.json.JSONObject; 005 006 import de.deepamehta.core.JSONEnabled; 007 008 public class Image implements JSONEnabled { 009 010 private final Long size; 011 012 private final String src; 013 014 private final String type; 015 016 public Image(String src, String mediaType, Long size) { 017 this.size = size; 018 this.src = src; 019 this.type = mediaType; 020 } 021 022 public Long getSize() { 023 return size; 024 } 025 026 public String getSrc() { 027 return src; 028 } 029 030 public String getType() { 031 return type; 032 } 033 034 @Override 035 public JSONObject toJSON() { 036 JSONObject image = new JSONObject(); 037 try { 038 image.put("src", src); 039 image.put("type", type); 040 } catch (JSONException e) { 041 throw new RuntimeException(e); 042 } 043 return image; 044 } 045 046 }