package com.rjconsultores.ventaboletos.web.utilerias.render;

import java.lang.reflect.Field;

import javax.persistence.Column;
import javax.persistence.Id;

import org.zkoss.zul.Listcell;
import org.zkoss.zul.Listitem;
import org.zkoss.zul.ListitemRenderer;

public class RenderAuditModuleDetail implements ListitemRenderer {
	
	@Override
	public void render(Listitem item, Object object) throws Exception {

		Listcell lc = null;

		for (Field field : object.getClass().getDeclaredFields()) {

			if (!field.isAnnotationPresent(Column.class) && !field.isAnnotationPresent(Id.class)) {
				continue;
			}

			field.setAccessible(true);
			
			String fieldValue = (field.get(object) == null ? "" : field.get(object)).toString();				

			lc = new Listcell(fieldValue);
			lc.setParent(item);
		}
	}
}
