alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Spring Framework example source code file (ImageDescriptor.java)

This example Spring Framework source code file (ImageDescriptor.java) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Spring Framework tags/keywords

imagedescriptor, imagedescriptor, no, no, short_description_max_length, short_description_max_length, string, string

The Spring Framework ImageDescriptor.java source code

package org.springframework.samples.imagedb;

import org.springframework.util.Assert;

/**
 * Simple data holder for image descriptions.
 *
 * @author Juergen Hoeller
 * @since 07.01.2004
 */
public class ImageDescriptor {

	public static final int SHORT_DESCRIPTION_MAX_LENGTH = 1000;

	private final String name;

	private final String description;

	protected ImageDescriptor(String name, String description) {
		Assert.notNull(name, "No image name specified");
		this.name = name;
		this.description = (description != null ? description : "");
	}

	public String getName() {
		return name;
	}

	public String getDescription() {
		return description;
	}

	public String getShortDescription() {
		return (description == null || description.length() <= SHORT_DESCRIPTION_MAX_LENGTH) ?
		    description : description.substring(0, SHORT_DESCRIPTION_MAX_LENGTH);
	}

	public int getDescriptionLength() {
		return (description != null ? description.length() : 0);
	}

}

Other Spring Framework examples (source code examples)

Here is a short list of links related to this Spring Framework ImageDescriptor.java source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.