1 /* 2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package com.sun.xml.internal.bind.annotation; 27 28 import java.lang.annotation.Retention; 29 import java.lang.annotation.Target; 30 31 import org.xml.sax.Locator; 32 33 import static java.lang.annotation.RetentionPolicy.RUNTIME; 34 import static java.lang.annotation.ElementType.FIELD; 35 import static java.lang.annotation.ElementType.METHOD; 36 37 /** 38 * Marks a property that receives a location from which the object is unmarshalled. 39 * 40 * <h2>Usage</h2> 41 * <p> 42 * The @XmlLocation can be specified on: 43 * <ul> 44 * <li>a field whose type is {@link Locator}, or 45 * <li>a method that takes a {@link Locator} as the sole parameter 46 * </ul> 47 * 48 * <p> 49 * When a class that contains such a field/method is unmarshalled by the JAXB RI, 50 * such a field/method will receive an immutable {@link Locator} object that describes 51 * the location in the XML document where the object is unmarshalled from. 52 * 53 * <p> 54 * If the unmarshaller does not know the source location information, the locator 55 * will not be set. For example, this happens when it is unmarshalling from a DOM tree. 56 * This also happens if you use JAXB implementations other than the JAXB RI. 57 * 58 * <p> 59 * This information can be used by applications, for example to provide user-friendly 60 * error information. 61 * 62 * 63 * @author Kohsuke Kawaguchi 64 * @since JAXB RI 2.0 EA 65 */ 66 @Retention(RUNTIME) @Target({FIELD,METHOD}) 67 public @interface XmlLocation { 68 }