[#3760] Add Record.intoList()
This commit is contained in:
parent
8fa9878f42
commit
83cebee0eb
@ -46,6 +46,7 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLData;
|
||||
import java.sql.Statement;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Generated;
|
||||
@ -683,6 +684,21 @@ public interface Record extends Attachable, Comparable<Record> {
|
||||
*/
|
||||
Object[] intoArray();
|
||||
|
||||
/**
|
||||
* Convert this record into a list.
|
||||
* <p>
|
||||
* The resulting list has the same number of elements as this record has
|
||||
* fields. The resulting array contains data as such:
|
||||
* <p>
|
||||
* <code><pre>
|
||||
* // For arbitrary values of i
|
||||
* record.getValue(i) == record.intoList().get(i)
|
||||
* </pre></code>
|
||||
* <p>
|
||||
* This is the same as calling <code>Arrays.asList(intoArray())</code>
|
||||
*/
|
||||
List<Object> intoList();
|
||||
|
||||
/**
|
||||
* Return this record as a name/value map.
|
||||
* <p>
|
||||
|
||||
@ -55,6 +55,7 @@ import static org.jooq.impl.Utils.settings;
|
||||
import java.lang.reflect.Method;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.BitSet;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedHashMap;
|
||||
@ -523,6 +524,11 @@ abstract class AbstractRecord extends AbstractStore implements Record {
|
||||
return into(Object[].class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final List<Object> intoList() {
|
||||
return Arrays.asList(intoArray());
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Map<String, Object> intoMap() {
|
||||
Map<String, Object> map = new LinkedHashMap<String, Object>();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user