KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > samples > imagedb > ImageDescriptor


1 package org.springframework.samples.imagedb;
2
3 import org.springframework.util.Assert;
4
5 /**
6  * Simple data holder for image descriptions.
7  *
8  * @author Juergen Hoeller
9  * @since 07.01.2004
10  */

11 public class ImageDescriptor {
12
13     public static final int SHORT_DESCRIPTION_MAX_LENGTH = 1000;
14
15     private final String JavaDoc name;
16
17     private final String JavaDoc description;
18
19     protected ImageDescriptor(String JavaDoc name, String JavaDoc description) {
20         Assert.notNull(name, "No image name specified");
21         this.name = name;
22         this.description = (description != null ? description : "");
23     }
24
25     public String JavaDoc getName() {
26         return name;
27     }
28
29     public String JavaDoc getDescription() {
30         return description;
31     }
32
33     public String JavaDoc getShortDescription() {
34         return (description == null || description.length() <= SHORT_DESCRIPTION_MAX_LENGTH) ?
35             description : description.substring(0, SHORT_DESCRIPTION_MAX_LENGTH);
36     }
37
38     public int getDescriptionLength() {
39         return (description != null ? description.length() : 0);
40     }
41
42 }
43
Popular Tags