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

📄 type.java

📁 JAVA EXCEL操作API
💻 JAVA
字号:
/*
 * Created on 2004-3-22
 *
 * To change the template for this generated file go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
package com.zosatapo.xls.core;

import java.util.HashMap;
import java.util.Map;

/**
 * @author Administrator
 *
 * To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
public final class Type
{ 
  public final static Type VARCHAR    = new Type("VARCHAR");
  public final static Type INTEGER    = new Type("INTEGER");
  public final static Type FLOAT      = new Type("FLOAT");
  public final static Type DATE       = new Type("DATE");
  public final static Type TIME       = new Type("TIME");
  public final static Type TIMESTAMP  = new Type("TIMESTAMP");
  
  
  private static final Map types=new HashMap();

  private static synchronized void populateTypes()
  {
    types.put("VARCHAR",VARCHAR);
    types.put("INTEGER",INTEGER);
    types.put("FLOAT",FLOAT);
    types.put("DATE",DATE);
    types.put("TIME",TIME);
    types.put("TIMESTAMP",TIMESTAMP);
  }
  
  static
  {
    populateTypes();
  }
  
  private String typeTag;  
  private Type(String typeTag_)
  {
    this.typeTag=typeTag_;
  } 
  
  public static Type valueOf(String typeDefine)
  {
    return Type.valueOf(typeDefine,false);
  }
  
  public static Type valueOf(String typeDefine,boolean useDefault)
  {   
    Type type=(Type)types.get(typeDefine);
    
    if(type==null)
    {
      if(useDefault)
      {
        type=VARCHAR;
      }
    }
    return type;
  }
  
  /**
   * use the function carefully
   */
  public void reset(Type dstType)
  {
    typeTag=dstType.typeTag;
  }
  
  public Type copy()
  {
    return new Type(typeTag);
  }
  
  public String tag()
  {
    return typeTag;
  }
  
  public int hasCode()
  {
    return typeTag.hashCode();
  } 
  
  public boolean equals(Object obj)
  {
    if (this == obj) 
    {
      return true;
    }
    
    if (obj instanceof Type) 
    {
      Type anotherColumnType = (Type)obj;
      
      if(anotherColumnType.typeTag.equals(typeTag))
      {
        return true;
      }      
    }
    
    return false;
  }
  
  public String toString()
  {
    return "[Type] "+typeTag;
  }
}

⌨️ 快捷键说明

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