Package org.opengis.example.util
Class SimpleNameFactory
- Object
-
- SimpleNameFactory
-
- All Implemented Interfaces:
Factory
,NameFactory
public class SimpleNameFactory extends Object implements NameFactory
ANameFactory
for creatingSimpleName
instances.
-
-
Field Summary
Fields Modifier and Type Field Description static SimpleNameFactory
DEFAULT
The default factory instance.protected Locale
locale
The single locale supported by our simplecreateInternationalString(Map)
method.protected Properties
syntax
The JNDI syntax of names.
-
Constructor Summary
Constructors Modifier Constructor Description SimpleNameFactory()
Creates a new factory initialized to the default syntax.protected
SimpleNameFactory(SimpleNameFactory parent)
Creates a new factory which will inherit syntax and locale configuration from the given parent.
-
Method Summary
Modifier and Type Method Description GenericName
createGenericName(NameSpace scope, CharSequence... parsedNames)
Creates a local or scoped name from an array of parsed names.InternationalString
createInternationalString(Map<Locale,String> strings)
Creates an international string.LocalName
createLocalName(NameSpace scope, CharSequence name)
Creates a local name from the given character sequence.MemberName
createMemberName(NameSpace scope, CharSequence name, TypeName attributeType)
Creates a member name from the given character sequence and attribute type.NameSpace
createNameSpace(GenericName name, Map<String,?> properties)
Creates a namespace having the given name and separators.TypeName
createTypeName(NameSpace scope, CharSequence name)
Creates a type name from the given character sequence.Citation
getVendor()
Returns the implementor responsible for creating the factory implementation.GenericName
parseGenericName(NameSpace scope, CharSequence name)
Constructs a generic name from a qualified name.String
toString()
Returns a string representation of this factory.
-
-
-
Field Detail
-
DEFAULT
public static final SimpleNameFactory DEFAULT
The default factory instance.
-
syntax
protected final Properties syntax
The JNDI syntax of names. By default, this map contains the following entries:JNDI properties "jndi.syntax.direction" = "left_to_right" "jndi.syntax.separator" = ":" - See Also:
CompoundName
-
locale
protected final Locale locale
The single locale supported by our simplecreateInternationalString(Map)
method. The default value is the system default.
-
-
Constructor Detail
-
SimpleNameFactory
public SimpleNameFactory()
Creates a new factory initialized to the default syntax.
-
SimpleNameFactory
protected SimpleNameFactory(SimpleNameFactory parent)
Creates a new factory which will inherit syntax and locale configuration from the given parent. Subclasses can modify thesyntax
properties in their constructor.- Parameters:
parent
- The parent factory.
-
-
Method Detail
-
getVendor
public Citation getVendor()
Returns the implementor responsible for creating the factory implementation.
-
createInternationalString
public InternationalString createInternationalString(Map<Locale,String> strings)
Creates an international string. The simple implementations in theorg.opengis.example
packages accept only one locale. Consequently this factory method will select only one string in the given map: the one which is associated to the closest match of this factory locale.- Specified by:
createInternationalString
in interfaceNameFactory
-
createNameSpace
public NameSpace createNameSpace(GenericName name, Map<String,?> properties)
Creates a namespace having the given name and separators. Theproperties
argument is optional: if non-null, the given properties may be given to the namespace to be created. This factory recognizes the properties listed in the following table:Namespace properties Property name Purpose "separator"
The separator to insert between parsed names in that namespace. For URN, this is typically ":"
.- Specified by:
createNameSpace
in interfaceNameFactory
-
createTypeName
public TypeName createTypeName(NameSpace scope, CharSequence name)
Creates a type name from the given character sequence. The character sequence shall complies to the same restriction thancreateLocalName
.- Specified by:
createTypeName
in interfaceNameFactory
- Parameters:
scope
- the scope of the type name to be created, ornull
for a global namespace.name
- the type name as a string or an international string.- Returns:
- the type name for the given character sequence.
-
createMemberName
public MemberName createMemberName(NameSpace scope, CharSequence name, TypeName attributeType)
Creates a member name from the given character sequence and attribute type.- Specified by:
createMemberName
in interfaceNameFactory
- Parameters:
scope
- the scope of the member name to be created, ornull
for a global namespace.name
- the member name as a string or an international string.attributeType
- the type of the data associated with the record member.- Returns:
- the member name for the given character sequence.
- Since:
- 3.1
-
createLocalName
public LocalName createLocalName(NameSpace scope, CharSequence name)
Creates a local name from the given character sequence.- Specified by:
createLocalName
in interfaceNameFactory
- Parameters:
scope
- the scope of the local name to be created, ornull
for a global namespace.name
- the local name as a string or an international string.- Returns:
- the local name for the given character sequence.
-
createGenericName
public GenericName createGenericName(NameSpace scope, CharSequence... parsedNames)
Creates a local or scoped name from an array of parsed names.- Specified by:
createGenericName
in interfaceNameFactory
- Parameters:
scope
- the scope of the generic name to be created, ornull
for a global namespace.parsedNames
- the local names as an array of strings or international strings. This array must contains at least one element.- Returns:
- the generic name for the given parsed names.
-
parseGenericName
public GenericName parseGenericName(NameSpace scope, CharSequence name)
Constructs a generic name from a qualified name. This method splits the given name around a separator inferred from the given scope, or syntax-dependent separator if the given scope is null.- Specified by:
parseGenericName
in interfaceNameFactory
- Parameters:
scope
- the scope of the generic name to be created, ornull
for a global namespace.name
- the qualified name, as a sequence of names separated by a scope-dependent separator.- Returns:
- a name parsed from the given string.
-
-