01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.object.dna.api;
05:
06: import com.tc.object.ObjectID;
07:
08: /**
09: * Interface for writing DNA. The Writer effectively defines the protocol for how
10: * DNA data is written to a stream.
11: */
12: public interface DNAWriter {
13:
14: /**
15: * Add logical action to the writer
16: * @param Method identifier, defined in {@link com.tc.object.SerializationUtil}
17: * @param parameters Parameter values
18: */
19: void addLogicalAction(int method, Object[] parameters);
20:
21: /**
22: * Add physical action to the writer representing field value, automatically
23: * determine whether value is a reference by checking whether it is an ObjectID
24: * @param fieldName The field name
25: * @param value The field value
26: */
27: void addPhysicalAction(String fieldName, Object value);
28:
29: /**
30: * Add physical action to the writer representing a field value, specify
31: * whether the value is a reference or not.
32: * @param fieldName The field name
33: * @param value The field value
34: * @param canBeReference Is this a reference
35: */
36: void addPhysicalAction(String fieldName, Object value,
37: boolean canBeReference);
38:
39: /**
40: * Add physical action for array element change
41: * @param index Index in the array
42: * @param value New value
43: */
44: void addArrayElementAction(int index, Object value);
45:
46: /**
47: * Add physical action for subarray change
48: * @param start Start index in the array
49: * @param array The array value
50: * @param length The length of the subarray
51: */
52: void addSubArrayAction(int start, Object array, int length);
53:
54: /**
55: * Add classloader action
56: * @param classLoaderFieldName Classloader field
57: * @param value Classloader
58: */
59: void addClassLoaderAction(String classLoaderFieldName, Object value);
60:
61: /**
62: * Add physical action for entire array
63: * @param value Array value
64: */
65: void addEntireArray(Object value);
66:
67: /**
68: * Add literal value
69: * @param value Literal value
70: */
71: void addLiteralValue(Object value);
72:
73: /**
74: * Finalize the DNA with a flag of whether it's delta or new
75: * @param isDeltaDNA True if delta, false if new
76: */
77: void finalizeDNA(boolean isDeltaDNA);
78:
79: /**
80: * Set parent object ID for inner classes
81: * @param id Parent object ID
82: */
83: void setParentObjectID(ObjectID id);
84:
85: /**
86: * Set array length
87: * @param length Length
88: */
89: void setArrayLength(int length);
90:
91: }
|