Skip to content

Package: Namespace

Namespace

Coverage

1: /**
2: * Copyright (C) 2022 Czech Technical University in Prague
3: *
4: * This program is free software: you can redistribute it and/or modify it under
5: * the terms of the GNU General Public License as published by the Free Software
6: * Foundation, either version 3 of the License, or (at your option) any
7: * later version.
8: *
9: * This program is distributed in the hope that it will be useful, but WITHOUT
10: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11: * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12: * details. You should have received a copy of the GNU General Public License
13: * along with this program. If not, see <http://www.gnu.org/licenses/>.
14: */
15: package cz.cvut.kbss.jopa.model.annotations;
16:
17: import java.lang.annotation.*;
18:
19: /**
20: * Namespace declaration allows the use of shorter notation for long URIs.
21: * <p>
22: * Namespace can be declared on package and class level. Class-level declaration overrides package-level namespace
23: * declaration (in case the prefix is the same).
24: *
25: * @see <a href="https://www.w3.org/TR/REC-xml-names/" target="_top">https://www.w3.org/TR/REC-xml-names/</a>
26: * @see Namespaces
27: */
28: @Inherited
29: @Retention(RetentionPolicy.RUNTIME)
30: @Target({ElementType.PACKAGE, ElementType.TYPE})
31: public @interface Namespace {
32:
33: /**
34: * Prefix to be used as a shorthand for the fully qualified namespace URI.
35: * <p>
36: * Corresponds to {@code xsd} in the {@code xmlns:xsd="http://www.w3.org/2001/XMLSchema#"} XML namespace
37: * declaration.
38: *
39: * @return The prefix to be used to reference a namespace
40: */
41: String prefix();
42:
43: /**
44: * Fully qualified namespace URI, which is mapped by {@link #prefix()}.
45: * <p>
46: * Corresponds to {@code http://www.w3.org/2001/XMLSchema#} in the {@code xmlns:xsd="http://www.w3.org/2001/XMLSchema#"}
47: * XML namespace declaration.
48: *
49: * @return The namespace URI
50: */
51: String namespace();
52: }