01: /*
02: * Copyright 2006 Werner Guttman
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.exolab.castor.xml;
17:
18: import org.exolab.castor.mapping.FieldDescriptor;
19:
20: /**
21: * Internal class used to save state for reference resolving.
22: * @author <a href="mailto:werner DOT guttmann AT gmx DOT net">Werner Guttmann</a>
23: * @version $Revision: 0000 $ $Date:$
24: */
25: class ReferenceInfo {
26:
27: /** The ID(REF) value of the target object instance. */
28: private final String id;
29: /** The target object referenced by this IDREF instance. */
30: private final Object target;
31: /** XML Field descriptor referenced by this IDREF instance. */
32: private final XMLFieldDescriptor descriptor;
33:
34: /** The 'next' ReferenceInfo instance. */
35: private ReferenceInfo next = null;
36:
37: /**
38: * Creates a new ReferenceInfo
39: * @param id
40: * @param target
41: * @param descriptor
42: */
43: public ReferenceInfo(final String id, final Object target,
44: final XMLFieldDescriptor descriptor) {
45: this .id = id;
46: this .target = target;
47: this .descriptor = descriptor;
48: }
49:
50: /**
51: * Sets a refrence to the 'next' ReferenceInfo instance.
52: * @param info The 'next' ReferenceInfo instance.
53: */
54: public void setNext(ReferenceInfo info) {
55: this .next = info;
56: }
57:
58: /**
59: * Returns the field descriptor referenced by this IDREF instance.
60: * @return the field descriptor referenced by this IDREF instance.
61: */
62: public FieldDescriptor getDescriptor() {
63: return this .descriptor;
64: }
65:
66: /**
67: * Returns the target object referenced by this IDREF instance.
68: * @return the target object referenced by this IDREF instance.
69: */
70: public Object getTarget() {
71: return this .target;
72: }
73:
74: /**
75: * Returns the next 'ReferenceInfo' instance.
76: * @return the next 'ReferenceInfo' instance.
77: */
78: public ReferenceInfo getNext() {
79: return this .next;
80: }
81:
82: /**
83: * Returns the ID value of the target object instance.
84: * @return the ID value of the target object instance.
85: */
86: public String getId() {
87: return this.id;
88: }
89:
90: }
|