All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.ioc.commons.japtsy.server.model.biz.EntityIdResolver Maven / Gradle / Ivy

There is a newer version: 1.2.1
Show newest version
package org.ioc.commons.japtsy.server.model.biz;

import org.ioc.commons.japtsy.shared.model.biz.JAPTSYServiceException;

/**
 * The {@link EntityIdResolver} is used by the JAPTSY system to translate entity
 * primary key (id) into string format and viceversa.
 * 
 * @author Jesús Lunar Pérez
 * 
 */
public interface EntityIdResolver {
	/**
	 * Gets an unique string value which represents the entity id passed as
	 * parameter.
	 * 
	 * It is the responsability of the implementations to ensure the returned
	 * string will represent one and only one entity in the system.
	 * 
	 * @param entity
	 *            id The entity id. It can be whichever objects that represents
	 *            an entity id, i.e. a java type such as String, Integer, Enum,
	 *            etc. or a custom composed id class.
	 * @return Unique string value.
	 * @throws JAPTSYServiceException
	 *             Something was wrong
	 */
	String getEntityIdAsString(Object entity) throws JAPTSYServiceException;

	/**
	 * Gets the entity id represented by unique id string.
	 * 
	 * @param idAsString
	 *            An unique entity id got previously by
	 *            {@link EntityIdResolver#getEntityIdAsString(Object)}.
	 * @return An entity id instance.
	 * @throws JAPTSYServiceException
	 *             Something was wrong
	 */
	Object getEntityIdFromString(String idAsString) throws JAPTSYServiceException;

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy