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