⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dictionaryfieldkey.java.svn-base

📁 自己封装的数据字典,可以配置要查询的表和字段快速得到结果
💻 SVN-BASE
字号:
package com.gisinfo.Dictionary;

import java.util.Hashtable;

/**
 * Author: Jimmy lin
 * Date: Nov 10, 2003
 * Time: 9:58:29 PM
 */
/**
 * This class represents  fields of one Dictionaryfield which has same tableName and fieldName
 */ 
public class DictionaryFieldKey extends DictionaryKey {
    private String fieldName ="";

    public DictionaryFieldKey(String tableName, String fieldName) {
        this.tableName = tableName;
        this.fieldName = fieldName;
    }

    public DictionaryFieldKey() {
    }

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

    public String getFieldName() {
        return fieldName;
    }

    public void setFieldName(String fieldName) {
        this.fieldName = fieldName;
    }

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

    //for test
    public void displayKey(){
         System.out .println("\ntable_name : " +this.tableName+
                 "\nfield_name : "+this.fieldName ) ;
    }
    public static void main(String[] argv){
        Hashtable ht = new Hashtable();
        DictionaryFieldKey dfk = new DictionaryFieldKey();
        dfk.setTableName("kkk");
        dfk.setFieldName("aaa");
        ht.put(dfk,"a");
        ht.get(dfk); 

    }
}

⌨️ 快捷键说明

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