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

se.l4.commons.id.LongIdCodec Maven / Gradle / Ivy

The newest version!
package se.l4.commons.id;

import edu.umd.cs.findbugs.annotations.NonNull;

/**
 * Codec for encoding and decoding an identifier.
 */
public interface LongIdCodec
{
	/**
	 * Encode the given identifier.
	 *
	 * @param id
	 *   the identifier to encode
	 * @return
	 *   encoded version of the id, never {@code null}
	 * @throws NumberFormatException
	 *   if unable to format the given id
	 */
	@NonNull
	T encode(long id);

	/**
	 * Decode the given identifier.
	 *
	 * @param in
	 *   the input to decode
	 * @return
	 *   parsed identifier
	 * @throws NumberFormatException
	 *   if unable to decode the given input
	 */
	long decode(@NonNull T in);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy