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

br.uff.sti.jerseymvcjasper.JasperModel Maven / Gradle / Ivy

Go to download

Jersey Teplate to integrate Jasper in Jersey Template system, generating PDF files

The newest version!
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package br.uff.sti.jerseymvcjasper;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Represents the fields ($F{}) and parameters ($P{}) of a Jasper.
 * @author marcos
 * @param  The type of model in the JasperModel
 */
public class JasperModel {

    private final Map parameters;
    private final List listModels;

    private JasperModel() {
        parameters = new HashMap<>();
        listModels = new ArrayList<>();
    }

    public JasperModel(List listModels, Map parameters) {
        this.parameters = parameters;
        this.listModels = listModels;
    }

    public Map getParameters() {
        return parameters;
    }

    public List getListModels() {
        return listModels;
    }

    public static  JasperModel create(Class clazz) {
        return new JasperModel<>();
    }

    public JasperModel addModels(T... arrayT) {
        listModels.clear();
        listModels.addAll(Arrays.asList(arrayT));
        return this;
    }

    public JasperModel putParam(String key, Object value) {
        parameters.put(key, value);
        return this;
    }

    Object getParam(String key) {
        return parameters.get(key);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy