cn.featherfly.data.impl.SimpleDataRecord Maven / Gradle / Ivy
package cn.featherfly.data.impl;
import java.util.Collection;
import java.util.Map;
import org.apache.commons.collections4.map.ListOrderedMap;
import cn.featherfly.data.core.DataRecord;
/**
*
* 简单数据记录
*
*
* @author 钟冀
*/
public class SimpleDataRecord implements DataRecord {
private ListOrderedMap values = new ListOrderedMap<>();
/**
*/
public SimpleDataRecord() {
}
/**
* @param values values
*/
public SimpleDataRecord(Map values) {
this.values.putAll(values);
}
/**
*
* 添加记录
*
*
* @param key key
* @param value value
*/
public void add(String key, Object value) {
values.put(key, value);
}
/**
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
@Override
public E get(int index) {
return (E) values.getValue(index);
}
/**
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
@Override
public E get(String key) {
return (E) values.get(key);
}
/**
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
@Override
public Collection getValues() {
return (Collection) values.valueList();
}
/**
* {@inheritDoc}
*/
@Override
public int getValuesNumber() {
return values.valueList().size();
}
/**
* {@inheritDoc}
*/
@Override
public Collection getKeys() {
return values.keySet();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy