All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.onetwo.easyui.EasyBuilder Maven / Gradle / Ivy

There is a newer version: 5.2.7
Show newest version
package org.onetwo.easyui;

import java.util.List;

import org.onetwo.common.utils.map.MappableMap;
import org.onetwo.common.utils.map.MappableMap.MappingValueFunc;
import org.onetwo.common.utils.map.MappableMap.StaticMappingBuilder;

@SuppressWarnings("unchecked")
public class EasyBuilder {
	protected StaticMappingBuilder builder = MappableMap.newMappingBuilder();

	public B mapAllFields(){
		this.builder.mapAllFields();
		return (B)this;
	}
	public B specifyMappedFields(){
		this.builder.specifyMappedFields();
		return (B)this;
	}
	
	public B addMapping(String fieldName, MappingValueFunc valueFunc){
		builder.addMapping(fieldName, valueFunc);
		return (B)this;
	}
	
	public B addMapping(String fieldName, String objectFieldName){
		builder.addMapping(fieldName, objectFieldName);
		return (B)this;
	}

	public List build(List sourceObjects){
		List treeDatas = builder.bindValues(sourceObjects);
		return treeDatas;
	}

	public MappableMap build(E sourceObjects){
		MappableMap mappableMap = builder.bindValue(sourceObjects);
		return mappableMap;
	}
	
	public static class SimpleEasyBuilder extends EasyBuilder, T> {
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy