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

com.github.taymindis.paas.QueryResult Maven / Gradle / Ivy

Go to download

Page as a service for JSP to standardize the function by jsp page, guarantee zero downtime

The newest version!
package com.github.taymindis.paas;

import java.util.List;
import java.util.Map;
import java.util.Set;

public class QueryResult  {

    private final Map> vMap;
    private int index = -1;
    private final int size;

    public QueryResult(Map> vMap, int totalSize) {
        this.vMap = vMap;
        this.size = totalSize;
    }

    public Object get(String colName) {
        return vMap.get(colName).get(index);
    }

    /**
     * @return first column value
     */
    public Object get() {
        List objects = vMap.values().iterator().next();
        if(objects != null && objects.size() > 0) {
            return objects.get(index);
        }
        return null;
    }

    /**
     * @return all the columns name
     */
    public Set getAllColumns() {
        return vMap.keySet();
    }

    public boolean next() {
        return ++index < this.size;
    }

}