maia_modificado/.svn/pristine/71/710686e65de0aed5ae27627d1f7...

126 lines
3.1 KiB
Plaintext
Executable File

package com.fp.persistence.parmas.inte;
import javax.persistence.Column;
import java.io.Serializable;
import com.fp.dto.hb.HibernateId;
import java.lang.reflect.Field;
import javax.persistence.Embeddable;
import javax.persistence.Transient;
/**Clase que hace referencia a la Clave Primaria de TARMTAGARMA*/
@Embeddable
public class TarmTagArmaKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{
/**
* HashCode asociado con la Instancia
*/
@Transient
private int hashValue = 0;
/**
* Version de la Clase
*/
private static final long serialVersionUID = 1L;
@Column(name="CARMA", nullable=false,updatable=false)
/**
* Codigo del arma
*/
private String carma;
@Column(name="CTAG", nullable=false,updatable=false)
/**
* Codigo del Tag
*/
private String ctag;
/**Contructor por defecto*/
public TarmTagArmaKey(){}
/**Contructor de TarmTagArmaKey
@param pCarma Codigo del arma
@param pCtag Codigo del Tag
*/
public TarmTagArmaKey(String pCarma,String pCtag){
carma=pCarma;
ctag=pCtag;
}
/**Obtiene el valor de carma
@return valor de carma*/
public String getCarma(){
return carma;
}
/**Fija el valor de carma
@param pCarma nuevo Valor de carma*/
public void setCarma(String pCarma){
carma=pCarma;
}
/**Obtiene el valor de ctag
@return valor de ctag*/
public String getCtag(){
return ctag;
}
/**Fija el valor de ctag
@param pCtag nuevo Valor de ctag*/
public void setCtag(String pCtag){
ctag=pCtag;
}
/**Implementacion de la comparacion de TarmTagArmaKey
@param o Objeto de comparacion
*/
public boolean equals(Object o){
if (o == null)return false;
if (! (o instanceof TarmTagArmaKey))return false;
TarmTagArmaKey that = (TarmTagArmaKey) o;
if (this.getCarma() == null || that.getCarma() == null){
return false;
}
if (! this.getCarma().equals(that.getCarma())){
return false;
}
if (this.getCtag() == null || that.getCtag() == null){
return false;
}
if (! this.getCtag().equals(that.getCtag())){
return false;
}
return true;
}
/**Implementacion del metodo hashCode bajo el patron de Bloch
@return hashCode de la instancia TarmTagArmaKey
*/
public int hashCode(){
if (this.hashValue == 0){
int result = 17;
result = result * 37 + (this.getCarma() == null ? 0 : this.getCarma().hashCode());
result = result * 37 + (this.getCtag() == null ? 0 : this.getCtag().hashCode());
this.hashValue = result;
}
return this.hashValue;
}
public Object cloneMe() throws CloneNotSupportedException {
return this.clone();
}
/**Implementacion toString
*/
public String toString() {
Field[]fs=this.getClass().getDeclaredFields();
String data="";
for(Field f:fs){
try{
String name=f.getName();
if(f.getType().getName().compareTo("java.util.Set")==0)continue;
if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue;
data+="pk."+name+"="+f.get(this)+";";
}catch(Exception e){
continue;
}
}
if(data.compareTo("")==0){
data=super.toString();
}
return data;
}
}