dictionarykey.java.svn-base

来自「自己封装的数据字典,可以配置要查询的表和字段快速得到结果」· SVN-BASE 代码 · 共 73 行

SVN-BASE
73
字号
package com.gisinfo.Dictionary;

/**
  * Author: Jimmy lin
 * Date: Nov 10, 2003
 * Time: 10:17:57 PM
 */
/**
 * This class represents fields of one dictionary which has same tablename
 */ 
public  class DictionaryKey {
    protected String tableName= "";

    public DictionaryKey() {
    }

    public DictionaryKey(String tableName) {
        this.tableName = tableName;
    }

    static public boolean stringCompareIgnoreCase(String a, String b){
        if (a == null ) {
            if (b == null)
                return true;
            else
                return false;
        }
        else{
            if (b == null)
                return false;
            else
              // return a.equals(b);
             return a.equalsIgnoreCase(b);
        }
    }
    static public boolean stringCompare(String a,String b){
        if (a == null ) {
            if (b == null)
                return true;
            else
                return false;
        }
        else{
            if (b == null)
                return false;
            else
               return a.equals(b);
        }
    }

    public  boolean equals(Object obj){
        if (obj instanceof DictionaryKey)  {
          DictionaryKey key = (DictionaryKey)obj;
            //we use ignore case method here 
         return stringCompareIgnoreCase(key.getTableName() ,this.tableName );
        }
        return false;
    }

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    public int hashCode() {
      //  return this.tableName == null ? 0 : this.tableName .charAt(this.tableName .length() -1);//会出现错误,因为大小写在这里的ascii是不同的
        return tableName.length();
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?