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

📄 attributetype.java

📁 Rapla是一个灵活的多用户资源管理系统。它提供的一些功能有:日历GUI
💻 JAVA
字号:
/*--------------------------------------------------------------------------*
 | Copyright (C) 2006 Christopher Kohlhaas                                  |
 |                                                                          |
 | This program is free software; you can redistribute it and/or modify     |
 | it under the terms of the GNU General Public License as published by the |
 | Free Software Foundation. A copy of the license has been included with   |
 | these distribution in the COPYING file, if not go to www.fsf.org         |
 |                                                                          |
 | As a special exception, you are granted the permissions to link this     |
 | program with every library, which license fulfills the Open Source       |
 | Definition as published by the Open Source Initiative (OSI).             |
 *--------------------------------------------------------------------------*/
package org.rapla.entities.dynamictype;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/** Attributes are to DynamicTypes, what properties are to Beans.
Currently Rapla supports the following types:
        <li>string</li>
        <li>int</li>
        <li>date</li>
        <li>boolean</li>
        <li>rapla:category</li>
@see DynamicType */
public class AttributeType implements Serializable {
    //  Don't forget to increase the serialVersionUID when you change the fields
    private static final long serialVersionUID = 1;
    
    private String type;
    
    static public AttributeType STRING = new AttributeType("string");
    static public AttributeType INT = new AttributeType("int");
    static public AttributeType DATE = new AttributeType("date");
    static public AttributeType BOOLEAN = new AttributeType("boolean");
    static public AttributeType CATEGORY = new AttributeType("rapla:category");
    
    private static Map types;

    private AttributeType(String type) {
        this.type = type;
        if (types == null) {
            types = new HashMap();
        }
        types.put( type, this);
    }
    
    public boolean is(AttributeType other) {
        if ( other == null)
            return false;
        return type.equals( other.type); 
    }
    
    public static AttributeType findForString(String string  ) {
         return (AttributeType) types.get( string );
    }
    
    public String toString() {
        return type;
    }
    
    public boolean equals( Object other) {
        if ( !(other instanceof AttributeType))
            return false;
        return is( (AttributeType)other);
    }
    
    public int hashCode() {
        return type.hashCode();
    }
}




⌨️ 快捷键说明

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