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

📄 link.java

📁 java写的blog
💻 JAVA
字号:
/*
 * Created on 2004-8-22
 * Author: Xuefeng, Copyright (C) 2004, Xuefeng.
 */
package org.crystalblog.domain;

import org.crystalblog.exception.ValidateException;

/**
 * @author Xuefeng
 */
public class Link implements Validator {

    private int categoryId; // foreign key
    private int linkId; // primary key

    private String title;
    private String url;
    private String rss = "";
    private boolean newWindow = true;

    public int getCategoryId() { return categoryId; }
    public void setCategoryId(int categoryId) { this.categoryId = categoryId; }

    public int getLinkId() { return linkId; }
    public void setLinkId(int linkId) { this.linkId = linkId; }

    public boolean getNewWindow() { return newWindow; }
    public void setNewWindow(boolean newWindow) { this.newWindow = newWindow; }

    public String getRss() { return rss; }
    public void setRss(String rss) { this.rss = rss; }

    public String getTitle() { return title; }
    public void setTitle(String title) { this.title = title; }

    public String getUrl() { return url; }
    public void setUrl(String url) { this.url = url; }

    public void validate() throws ValidateException {
        if(title==null || title.equals(""))
            throw new ValidateException(INVALID_LINK_TITLE);
        if(url==null || url.equals("") || !url.matches("http://[^<>]*"))
            throw new ValidateException(INVALID_LINK_URL);
        if(rss!=null && !rss.equals("")) {
            if(!rss.matches("http://[^<>]*"))
                throw new ValidateException(INVALID_LINK_RSS);
        }
    }
}

⌨️ 快捷键说明

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