Skip to content

Package: Namespace

Namespace

Coverage

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