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

fr.lteconsulting.angular2gwt.client.interop.ng.AngularTools Maven / Gradle / Ivy

There is a newer version: 1.8
Show newest version
package fr.lteconsulting.angular2gwt.client.interop.ng;

import fr.lteconsulting.angular2gwt.client.JsArray;
import fr.lteconsulting.angular2gwt.client.JsTools;

public class AngularTools
{
	public static  T convertDto( Object dto, Class targetClass )
	{
		T result = JsTools.convertObject( targetClass.getName(), dto );
		return result;
	}

	public static  JsArray convertDtoList( JsArray dtoList, Class targetClass )
	{
		JsArray result = new JsArray<>();
		if( dtoList != null )
		{
			for( Object dto : dtoList.iterate() )
			{
				T converted = convertDto( dto, targetClass );
				result.push( converted );
			}
		}
		return result;
	}
}