[#1634] Improve the performance of Factory.newRecord() by avoiding
accessing record values by Field rather than by index
This commit is contained in:
parent
e2b6b8dc9a
commit
79c29febc0
@ -95,8 +95,9 @@ abstract class AbstractRecord extends AbstractStore<Object> implements Record {
|
||||
public final List<Attachable> getAttachables() {
|
||||
List<Attachable> result = new ArrayList<Attachable>();
|
||||
|
||||
for (Field<?> field : getFields()) {
|
||||
Object value = getValue(field);
|
||||
int size = getFields().size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
Object value = getValue0(i);
|
||||
|
||||
if (value instanceof Attachable) {
|
||||
result.add((Attachable) value);
|
||||
@ -131,6 +132,11 @@ abstract class AbstractRecord extends AbstractStore<Object> implements Record {
|
||||
return getFields().size();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
final <T> Value<T> getValue0(int index) {
|
||||
return (Value<T>) getValues()[index];
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
final <T> Value<T> getValue0(Field<T> field) {
|
||||
return (Value<T>) getValues()[getIndex(field)];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user