Package org.opengis.geoapi
Class NameSpaces
- Object
-
- NameSpaces
-
public final class NameSpaces extends Object
Mapping from XML prefixes or Java types to programmatic namespaces (modules or packages). There is not necessarily a one-to-one relationship between XML namespaces, Java packages or Python modules. For example we may merge some XML namespaces in a single programmatic namespace if keeping them separated would result in modules or packages with few classes.- Since:
- 3.1
-
-
Constructor Summary
Constructors Constructor Description NameSpaces()
Creates a new mapping from XML namespaces (identified by prefixes) to programmatic namespaces.
-
Method Summary
Modifier and Type Method Description void
exclude(String... prefixes)
Excludes the namespaces identified by the given prefixes.QName
name(Class<?> type, Map<String,SchemaInformation.Element> definition)
Returns the OGC/ISO name of the given type together with its XML prefix and pseudo-namespace, ornull
.Set<String>
packages()
Returns all namespace values that may be returned byname(Class, Map)
.
-
-
-
Constructor Detail
-
NameSpaces
public NameSpaces()
Creates a new mapping from XML namespaces (identified by prefixes) to programmatic namespaces.
-
-
Method Detail
-
exclude
public void exclude(String... prefixes)
Excludes the namespaces identified by the given prefixes. Calls toname(Class, Map)
for a type in the namespace identified by one of the given prefixes will returnnull
.- Parameters:
prefixes
- identifications of the namespaces to exclude.
-
name
public QName name(Class<?> type, Map<String,SchemaInformation.Element> definition)
Returns the OGC/ISO name of the given type together with its XML prefix and pseudo-namespace, ornull
. Note that while we use theQName
object for convenience, this is not the XML name:QName.getLocalPart()
will be the OGC/ISO name, which is usually the same than the XML local part but not always.QName.getPrefix()
will be the XML prefix if known, or the UML prefix otherwise. May be empty is no prefix can be inferred.QName.getNamespaceURI()
will be the programmatic namespace. This may be a fragment of the XML namespace but never the full URI.
- Parameters:
type
- the type for which to get the namespace, ornull
.definition
- value ofSchemaInformation.getTypeDefinition(Class)
for the giventype
, ornull
if unknown.- Returns:
- the OGC/ISO name, prefix and pseudo-namespace for the given type, or
null
if none.
-
packages
public Set<String> packages()
Returns all namespace values that may be returned byname(Class, Map)
. This method returns a modifiable set. Modifications to the returned set will not affect thisNameSpaces
instance.- Returns:
- all package names known to this
NameSpaces
instance.
-
-