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

📄 longconverter.java

📁 一个购房管理系统,JSF+Hibernate+Mssql2
💻 JAVA
字号:
/*
 * BuildingConverter.java
 *
 * Created on 2007��5��29��, ����2:59
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package com.housesale.jsfbean;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;

/**
 * 
 * @author MSQ
 */
public class LongConverter implements Converter {

	/** Creates a new instance of BuildingConverter */
	public LongConverter() {
	}

	public Object getAsObject(FacesContext facesContext,
			UIComponent uIComponent, String string) {
		if (string == null) {
			return null;
		}
		Long id = Long.valueOf(string);

		return id;
	}

	public String getAsString(FacesContext facesContext,
			UIComponent uIComponent, Object object) {
		if (object == null) {
			return null;
		}
		if (object instanceof Long) {
			Long o = (Long) object;
			String password = o.toString();
			return "" + password;
		} else {
			throw new IllegalArgumentException("object:" + object + " of type:"
					+ object.getClass().getName() + "; expected type: Long");
		}
	}

}

⌨️ 快捷键说明

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