`
dwangel
  • 浏览: 266354 次
社区版块
存档分类
最新评论

DigesterHelper

 
阅读更多
package com.xianyu.util;

import org.apache.commons.digester3.Digester;

public class DigesterHelper {
	private Digester dig;
	public DigesterHelper(Digester dig) {
		this.dig = dig;
	}
	
	public DigesterHelper() {
		this.dig = new Digester();
	}

	public DigesterHelper createSetObject(String pattern, Class<?> clazz) {
		this.dig.addObjectCreate(pattern, clazz);
		this.dig.addSetProperties(pattern);
		return this;
	}
	public DigesterHelper createSetChild(String pattern, Class<?> clazz,String methodName) {
		this.dig.addObjectCreate(pattern, clazz);
		this.dig.addSetProperties(pattern);
		this.dig.addSetNext(pattern, methodName);
		return this;
	}
	public DigesterHelper setPropertyWith(String pattern, String property) {
		dig.addBeanPropertySetter(pattern, property);
		return this;
	}
	
	public Digester getDigester() {
		return this.dig;
	}
}
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics