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

net.hexonet.apiconnector.Record Maven / Gradle / Ivy

There is a newer version: 4.0.18
Show newest version
package net.hexonet.apiconnector;

import java.util.HashMap;
import java.util.Map;

/**
 * Record covers Row Data in a better accessible way
 * 
 * @author Kai Schwarz
 * @version %I%, %G%
 * @since 2.0
 */
public class Record {
    /** row data container */
    private Map data;

    /**
     * Class constructor
     * 
     * @param data row data as associative array
     */
    public Record(Map data) {
        this.data = new HashMap(data);
    }

    /**
     * Get full row data
     * 
     * @return full row data
     */
    public Map getData() {
        return this.data;
    }

    /**
     * Get data for given golumn name
     * 
     * @param key column name
     * @return data for given column name
     */
    public String getDataByKey(String key) {
        if (this.hasData(key)) {
            return this.data.get(key);
        }
        return null;
    }

    /**
     * Check if column data exists
     * 
     * @return boolean check result
     */
    private boolean hasData(String key) {
        return this.data.containsKey(key);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy