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

📄 abstractpropertiessupport.java

📁 Mandarax是一个规则引擎的纯Java实现。它支持多类型的事实和基于反映的规则
💻 JAVA
字号:
/*
 * Copyright (C) 1999-2004 <A href="http://www-ist.massey.ac.nz/JBDietrich" target="_top">Jens Dietrich</a>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
 
package org.mandarax.kernel;

import java.util.Enumeration;
import java.util.Properties;

/**
 * Abstract class implementing PropertySupport
 * @author <A href="http://www-ist.massey.ac.nz/JBDietrich" target="_top">Jens Dietrich</A>
 * @version 3.4 <7 March 05>
 * @since 2.0
 */

public abstract class AbstractPropertiesSupport implements PropertiesSupport, java.io.Serializable {
	
	private Properties delegate = null;
	
	/**
	 * Set a property.
	 * @param key the key
	 * @param value the value
	 * @return the previous value of the specified key in this property list, or null if it did not have one.
	 */
	public Object setProperty(String key,String value) {
		if (delegate==null) delegate = new Properties();
		return delegate.setProperty(key,value);	
	}
	/**
	 * Get a property.
	 * @param key the property key
	 * @return the respective value. The method returns null if the property is not found. 
	 */
	public String getProperty(String key) {
		if (delegate==null) delegate = new Properties();
		return delegate.getProperty(key);		
	}
	/** 
	 * Returns an enumeration of all the keys in this property list, including distinct 
	 * keys in the default property list if a key of the same name has not already been 
	 * found from the main properties list. 
	 * @return an enumeration of all the keys in this property list, including the keys in 
	 * the default property list
	 */
	public Enumeration propertyNames() {
		if (delegate==null) delegate = new Properties();
		return delegate.propertyNames();	
	}
	/**
	 * Remove a property.
	 * @param key the property key
	 * @return the value to which the key had been mapped, or null if the key did not have a mapping.
	 */
	public Object removeProperty(String key) {
		if (delegate!=null) return delegate.remove(key);
		return null;
	}
	/**
	 * Get the properties as one "properties" instance.
	 * @return a properties instance
	 */
	public Properties getProperties() {
		if (delegate==null) delegate = new Properties();
		return delegate;
	};
	/**
	 * Set the properties. Not required by the interface, but useful for bean (introspection-) based
	 * tools.
	 * @param properties the properties
	 */
	public void setProperties(Properties properties) {
		delegate = properties;
	};
}

⌨️ 快捷键说明

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