01: /*-
02: * See the file LICENSE for redistribution information.
03: *
04: * Copyright (c) 2002,2008 Oracle. All rights reserved.
05: *
06: * $Id: RawComplexInput.java,v 1.4.2.2 2008/01/07 15:14:20 cwl Exp $
07: */
08:
09: package com.sleepycat.persist.impl;
10:
11: import java.util.IdentityHashMap;
12:
13: import com.sleepycat.persist.raw.RawObject;
14:
15: /**
16: * Extends RawAbstractInput to convert complex (ComplexFormat and
17: * CompositeKeyFormat) RawObject instances.
18: *
19: * @author Mark Hayes
20: */
21: class RawComplexInput extends RawAbstractInput {
22:
23: private FieldInfo[] fields;
24: private RawObject[] objects;
25: private int index;
26:
27: RawComplexInput(Catalog catalog, boolean rawAccess,
28: IdentityHashMap converted, FieldInfo[] fields,
29: RawObject[] objects) {
30: super (catalog, rawAccess, converted);
31: this .fields = fields;
32: this .objects = objects;
33: }
34:
35: @Override
36: Object readNext() {
37: RawObject raw = objects[index];
38: FieldInfo field = fields[index];
39: index += 1;
40: Format format = field.getType();
41: Object o = raw.getValues().get(field.getName());
42: return checkAndConvert(o, format);
43: }
44: }
|