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

📄 metaclass.java

📁 xwiki 源码
💻 JAVA
字号:
/**
 * ===================================================================
 *
 * Copyright (c) 2003 Ludovic Dubost, All rights reserved.
 *
 * 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; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details, published at
 * http://www.gnu.org/copyleft/gpl.html or in gpl.txt in the
 * root folder of this distribution.

 * Created by
 * User: Ludovic Dubost
 * Date: 19 d閏. 2003
 * Time: 18:49:14
 */
package com.xpn.xwiki.objects.meta;

import com.xpn.xwiki.objects.BaseCollection;
import com.xpn.xwiki.objects.BaseProperty;
import com.xpn.xwiki.objects.PropertyInterface;
import com.xpn.xwiki.objects.classes.BaseClass;
import com.xpn.xwiki.objects.classes.PropertyClass;

public class MetaClass extends BaseClass {

    private static MetaClass metaClass = new MetaClass();

    public MetaClass() {
        NumberMetaClass numberclass = new NumberMetaClass();
        safeput(numberclass.getName(), numberclass);
        StringMetaClass stringclass = new StringMetaClass();
        safeput(stringclass.getName(), stringclass);
        TextAreaMetaClass textareaclass = new TextAreaMetaClass();
        safeput(textareaclass.getName(), textareaclass);
        PasswordMetaClass passwdclass = new PasswordMetaClass();
        safeput(passwdclass.getName(), passwdclass);
        BooleanMetaClass booleanclass = new BooleanMetaClass();
        safeput(booleanclass.getName(), booleanclass);
        StaticListMetaClass listclass = new StaticListMetaClass();
        safeput(listclass.getName(), listclass);
        DBListMetaClass dblistclass = new DBListMetaClass();
        safeput(dblistclass.getName(), dblistclass);
        DateMetaClass dateclass = new DateMetaClass();
        safeput(dateclass.getName(), dateclass);
    }

    public void safeput(String name, PropertyInterface property) {
        addField("meta" + name, property);
        if (property instanceof PropertyClass) {
         ((PropertyClass)property).setObject(this);
         ((BaseProperty)property).setName(name);
        }
    }

    public PropertyInterface safeget(String name) {
        return super.safeget("meta" + name);    //To change body of overriden methods use Options | File Templates.
    }

    public PropertyInterface get(String name) {
        return safeget(name);
    }

    public void put(String name, PropertyInterface property) {
        safeput(name, property);
    }

    public static MetaClass getMetaClass() {
        return metaClass;
    }

    public static void setMetaClass(MetaClass metaClass) {
        MetaClass.metaClass = metaClass;
    }

    public BaseCollection newObject() {
        return new BaseClass();
    }

}

⌨️ 快捷键说明

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