1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package com.commsen.jwebthumb;
20
21 import org.apache.commons.lang.Validate;
22 import org.apache.commons.lang.builder.ToStringBuilder;
23 import org.simpleframework.xml.Element;
24
25 /***
26 * This class represents the payload of webthumb's 'fetch' API call. See <a
27 * href="http://webthumb.bluga.net/apidoc#fetch">http://webthumb.bluga.net/apidoc#fetch</a> for
28 * details
29 *
30 * @author <a href="mailto:MilenDyankov@gmail.com">Milen Dyankov</a>
31 * @see http://webthumb.bluga.net/apidoc#fetch
32 *
33 */
34 public class WebThumbFetchRequest {
35
36 /***
37 * Enumeration contains all sizes acceptable by webthumb's fetch method For more details check
38 * webthumb API at http://webthumb.bluga.net/apidoc#fetch
39 *
40 * @author <a href="mailto:MilenDyankov@gmail.com">Milen Dyankov</a>
41 *
42 */
43 public static enum Size {
44 small, medium, medium2, large, full, excerpt, effect, custom, zip
45 };
46
47 @Element
48 private String job;
49
50 @Element
51 private Size size;
52
53
54 /***
55 * Constructs new fetch request to webthumb.bluga.net
56 *
57 * @param job - the job id
58 * @param size - the size of the file
59 */
60 public WebThumbFetchRequest(String job, Size size) {
61 Validate.notNull(job, "job is null!");
62 Validate.notNull(size, "size is null!");
63 this.job = job;
64 this.size = size;
65 }
66
67
68 @Override
69 public String toString() {
70 return new ToStringBuilder(this).append("job", job).append("size", size).toString();
71 }
72
73 }