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

📄 model.java

📁 用jbuilder写的源程序
💻 JAVA
字号:
/*
 * Copyright 2003-2006 the original author or authors.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 */
package com.jdon.controller.model;


/**
 * Base domain model it can be DTO or nested Model. it is the important message
 * between business layer and view layer. in view layer, it is created by form
 * object(such as ActionForm object);in business layer, it is created by
 * business components(such as session bean).
 * 
 * thi class can be cached, and setModified is important, this method can be
 * used to refresh the cache.
 * 
 * because setModified function ,so the class is designed for a class, but not a
 * interface.
 * 
 * the difference with setModified and setCacheable;
 * setCacheable to false, the model will never exist in the cache.
 * setModified to true, if the model exists in the cache, the client will not 
 * get it from cache, it is same as being deleted from cache .
 * deleting the model from cache must have a condition that the deleting operator
 * can access the cache of the container, if it cann't access the container, 
 * it cann't delete the model from cache. such it is EJB. 
 * 
 * 
 * 
 * @author banq
 */
public class Model implements ModelIF{

    /**
     * if set false, this Model will not be saved to cache, so 
     * this model will not be got from the cache.
     */
    private boolean cacheable = true;

    /**
     * if set true, this model will not be got from the cache,  
     * because it must have been saved in the cache.
     * this function is same as deleting the model from the cache.
     */
    private boolean modified;
    

    /**
     * in the past version, this method name is isCacheble,
     * now change it after 1.3 !
     */
    public boolean isCacheable() {
        return cacheable;
    }

    /**
     * in the past version, this method name is setCacheble,
     * now change it  after 1.3 !
     */
    public void setCacheable(boolean cacheable) {
        this.cacheable = cacheable;
    }

    public boolean isModified() {
        return modified;
    }

    /**
     * set the property has been modified such as : setName(String name){
     * this.name = name; setModified(true); }  
     */
    public void setModified(boolean modified) {
        this.modified = modified;
    }
    

}

⌨️ 快捷键说明

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