persistenceproperty.java

来自「软件设计课做的一个类似Hibernate的O/R Mapping的框架」· Java 代码 · 共 120 行

JAVA
120
字号
package cn.edu.nju.software.sd.torm.cfg;

/**
 * The class PersistenceProperty is a structure used to store the persistance
 * information of a property. It defines the property name and corresponding
 * column name. It also contains other essential information of this property.
 * 
 * @author Yinfei XU
 * 
 */
public class PersistenceProperty {
	private String propertyName;

	private String columnName;

	private int propertyType;

	private boolean notNull = false;

	public PersistenceProperty() {

	}

	/**
	 * Create a PersistenceProperty.
	 * 
	 * @param propertyName
	 *            the name of the property.
	 * @param columnName
	 *            the column of the property.
	 * @param propertyType
	 *            the type of the property.
	 */
	public PersistenceProperty(String propertyName, String columnName,
			int propertyType) {
		super();
		this.propertyName = propertyName;
		this.columnName = columnName;
		this.propertyType = propertyType;
	}

	/**
	 * Get the column name of this property.
	 * 
	 * @return The column name of this property.
	 */
	public String getColumnName() {
		return columnName;
	}

	/**
	 * Set the column name of this property.
	 * 
	 * @param columnName
	 *            The column name of this property.
	 */
	public void setColumnName(String columnName) {
		this.columnName = columnName;
	}

	/**
	 * Get the name of this property.
	 * 
	 * @return The name of this property.
	 */
	public String getPropertyName() {
		return propertyName;
	}

	/**
	 * Set the name of this property.
	 * 
	 * @param propertyName
	 *            The name of this property.
	 */
	public void setPropertyName(String propertyName) {
		this.propertyName = propertyName;
	}

	/**
	 * Get the type of this property.
	 * 
	 * @return The type of this property.
	 */
	public int getPropertyType() {
		return propertyType;
	}

	/**
	 * Set the type of this property.
	 * 
	 * @param propertyType
	 *            The type of this property.
	 */
	public void setPropertyType(int propertyType) {
		this.propertyType = propertyType;
	}

	/**
	 * Determine whether this property could be set to NULL.
	 * 
	 * @return A boolean value which indicates whether this property could be
	 *         set to NULL.
	 */
	public boolean isNotNull() {
		return notNull;
	}

	/**
	 * Determine whether this property could be set to NULL.
	 * 
	 * @param notNull
	 *            A boolean value which indicates whether this property could be
	 *            set to NULL.
	 */
	public void setNotNull(boolean notNull) {
		this.notNull = notNull;
	}
}

⌨️ 快捷键说明

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