1 /**
2 *
3 */
4 package ar.com.jiji.kaya.model;
5
6 import org.apache.commons.lang.StringUtils;
7
8 import ar.com.jiji.kaya.utils.ValidateUtils;
9
10 /**
11 * Representa un numero de cuit/cuil. TODO: por ahora solo tiene un string y no
12 * chequea nada, despues agregarle validaciones.
13 *
14 * @author lparra
15 *
16 */
17 public class CUIT {
18 private String numero;
19
20
21 public CUIT() {
22 }
23
24 /**
25 * @param numero
26 * @throws IllegalArgumentException
27 * Cuando el numero es null.
28 */
29 public CUIT(String numero) throws IllegalArgumentException {
30 setNumero(numero);
31 }
32
33 /**
34 * Devuelve el numero de cuit/cuil.
35 *
36 * @return El numero de cuit/cuil.
37 */
38 public String getNumero() {
39 return numero;
40 }
41
42 /**
43 * Setea el numero.
44 *
45 * @param numero
46 * @throws IllegalArgumentException
47 * Si el numero es null
48 *
49 */
50 protected void setNumero(String numero) throws IllegalArgumentException {
51 ValidateUtils.argNotNull(numero, "cuit/cuil");
52 this.numero = numero;
53 }
54
55 public String toString() {
56 return getNumero();
57 }
58
59 public boolean equals(Object o) {
60 if (!(o instanceof CUIT))
61 return false;
62 CUIT c = (CUIT) o;
63 return StringUtils.equals(getNumero(), c.getNumero());
64 }
65 }