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

com.realcomp.prime.validation.field.ForeignKey Maven / Gradle / Ivy

There is a newer version: 0.5.8
Show newest version
package com.realcomp.prime.validation.field;

import com.realcomp.prime.annotation.Validator;
import com.realcomp.prime.validation.Severity;

/**
 * Marks the value as a 'foreign key'.
 *
 */
@Validator("foreignKey")
public class ForeignKey extends Key{

    protected String name;

    public ForeignKey(){
        super();
        severity = Severity.HIGH;
    }

    public ForeignKey(String name){
        this.name = name;
    }

    public String getName(){
        return name;
    }

    public void setName(String name){
        this.name = name;
    }

    @Override
    public ForeignKey copyOf(){
        ForeignKey copy = new ForeignKey(name);
        copy.setSeverity(severity);
        return copy;
    }

    @Override
    public boolean equals(Object obj){
        if (obj == null){
            return false;
        }
        if (getClass() != obj.getClass()){
            return false;
        }
        final ForeignKey other = (ForeignKey) obj;
        if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)){
            return false;
        }
        return true;
    }

    @Override
    public int hashCode(){
        int hash = 5;
        hash = 89 * hash + (this.name != null ? this.name.hashCode() : 0);
        return hash;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy