net.kamhon.ieagle.function.system.vo.SysParamKey.java Source code

Java tutorial

Introduction

Here is the source code for net.kamhon.ieagle.function.system.vo.SysParamKey.java

Source

/*
 * Copyright 2012 Eng Kam Hon (kamhon@gmail.com)
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package net.kamhon.ieagle.function.system.vo;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Embeddable;

import net.kamhon.ieagle.vo.annotation.ToTrim;
import net.kamhon.ieagle.vo.annotation.ToUpperCase;

import org.apache.commons.lang.builder.HashCodeBuilder;

@Embeddable
public class SysParamKey implements Serializable {
    private static final long serialVersionUID = 1L;

    @ToTrim
    @ToUpperCase
    @Column(name = "sys_param_code", length = 20, nullable = false)
    private String sysParamCode;

    @Column(name = "comp_id", length = 32, nullable = false)
    private String compId;

    public SysParamKey() {
    }

    public SysParamKey(String sysParamCode, String compId) {
        this.sysParamCode = sysParamCode;
        this.compId = compId;
    }

    public String getSysParamCode() {
        return sysParamCode;
    }

    public String getCompId() {
        return compId;
    }

    public void setSysParamCode(String sysParamCode) {
        this.sysParamCode = sysParamCode;
    }

    public void setCompId(String compId) {
        this.compId = compId;
    }

    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        final SysParamKey other = (SysParamKey) obj;
        if (this.sysParamCode == null) {
            if (other.sysParamCode != null)
                return false;
        } else if (!this.sysParamCode.equals(other.sysParamCode))
            return false;
        if (this.compId == null) {
            if (other.compId != null)
                return false;
        } else if (!this.compId.equals(other.compId))
            return false;
        return true;
    }

    public int hashCode() {
        HashCodeBuilder hashCode = new HashCodeBuilder();
        if (sysParamCode != null)
            hashCode.append(sysParamCode);
        if (compId != null)
            hashCode.append(compId);
        return hashCode.toHashCode();
    }
}