package application.modeles;
import application.exceptions.DataFormatException;
public class ModeleGenre
{
private String _code;
private String _libelle;
/**
*
* Constructeur
*
*/
public ModeleGenre()
{
_code = null;
_libelle = null;
}
/**
*
* Constructeur
*
* @param code Code du genre
* @param libelle Libelle du genre
* @throws DataFormatException Si parametre incorrect
*
*/
public ModeleGenre(String code, String libelle) throws DataFormatException
{
setCode(code);
setLibelle(libelle);
}
/* (non-Javadoc)
*
* Permet de nettoyer l'objet avant que le systeme de
* Garbage Collector ne s'en charge.
*
* @see java.lang.Object#finalize()
*/
public void finalize(){
}
/**
*
* Getters
*
*/
public String getCode() { return _code; }
public String getLibelle() { return _libelle; }
/**
*
* Setters
*
*/
public void setCode(String code) throws DataFormatException
{
if(code.length() < 1 || code.length() > 2)
throw new DataFormatException("Le code genre doit faire entre 1 et 2 caracteres.");
_code = code;
}
public void setLibelle(String libelle) throws DataFormatException
{
if(libelle.length() < 1 || libelle.length() > 30)
throw new DataFormatException("Le libelle doit faire entre 1 et 30 caracteres.");
_libelle = libelle;
}
}