org.springframework.cglib.beans.BeanGenerator Java Examples

The following examples show how to use org.springframework.cglib.beans.BeanGenerator. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DynamicDTO.java    From jea with Apache License 2.0 6 votes vote down vote up
public DynamicDTO(Map<String, Object> map){
	generator = new BeanGenerator();
	/*使用Kryo序列化Map时,发现HashMap的序列化会报NullPointException,用TreeMap就没问题*/
	/*考虑到可能会使用DynamicDTO来获得Map对象,实例化时使用TreeMap类型*/
	valueMap = new TreeMap<String, Object>();
	Iterator<String> keys = map.keySet().iterator();
	String key = null;
	while(keys.hasNext()){
		key = keys.next();
		this.setValue(key, map.get(key));
	}
	try {
		generateBean();
	} catch (Exception e) {
		throw new RuntimeException("生成Bean对象时出现异常!");
	}
}
 
Example #2
Source File: DynamicDTO.java    From jea with Apache License 2.0 5 votes vote down vote up
public DynamicDTO(BaseModel model){
	generator = new BeanGenerator();
	valueMap = new TreeMap<String, Object>();
	beanObject = model;
	beanMap = BeanMap.create(model);
	valueMap.putAll(beanMap);
}
 
Example #3
Source File: DynamicDTO.java    From jea with Apache License 2.0 5 votes vote down vote up
/**
 * 建议用于SOAP对象的转换,一般的JavaBean请继承BaseDTO或BasePO
 * @param obj
 */
public DynamicDTO(Object obj){
	generator = new BeanGenerator();
	valueMap = new TreeMap<String, Object>();
	beanObject = obj;
	beanMap = BeanMap.create(obj);
	valueMap.putAll(beanMap);
}
 
Example #4
Source File: DynamicDTO.java    From jea with Apache License 2.0 4 votes vote down vote up
public DynamicDTO(){
	generator = new BeanGenerator();
	valueMap = new TreeMap<String, Object>();
}