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

com.jiuxian.mossrose.ui.vo.JobVoHelper Maven / Gradle / Ivy

There is a newer version: 1.1.5-RELEASE
Show newest version
package com.jiuxian.mossrose.ui.vo;

import java.lang.reflect.InvocationTargetException;
import java.util.List;
import java.util.stream.Collectors;

import org.apache.commons.beanutils.BeanUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.jiuxian.mossrose.JobOperation.JobRuntimeInfo;

public final class JobVoHelper {

	private static final Logger LOGGER = LoggerFactory.getLogger(JobVoHelper.class);

	public static JobVo toVo(JobRuntimeInfo job) {
		try {
			JobVo vo = new JobVo();
			BeanUtils.copyProperties(vo, job);
			return vo;
		} catch (IllegalAccessException | InvocationTargetException e) {
			LOGGER.error(e.getMessage(), e);
		}
		return null;
	}

	public static List toVos(List jobs) {
		if (jobs != null) {
			return jobs.stream().map(JobVoHelper::toVo).collect(Collectors.toList());
		}
		return null;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy