public class DefaultNameFactory extends AbstractFactory implements NameFactory
AbstractName
objects.
This factory provides the following methods for creating name instances:
createTypeName(NameSpace, CharSequence)
createMemberName(NameSpace, CharSequence, TypeName)
createLocalName(NameSpace, CharSequence)
createGenericName(NameSpace, CharSequence[])
– for local or scoped namesDefaultNameFactory
instance can be safely used by many threads without synchronization
on the part of the caller. Subclasses should make sure that any overridden methods remain safe to call
from multiple threads.Defined in the sis-utility
module
Constructor and Description |
---|
DefaultNameFactory()
Creates a new factory.
|
Modifier and Type | Method and 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 from a set of strings in different locales.
|
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.
|
TypeName |
createTypeName(NameSpace scope,
CharSequence name)
Creates a type name from the given character sequence.
|
GenericName |
parseGenericName(NameSpace scope,
CharSequence name)
Constructs a generic name from a qualified name.
|
getVendor
public InternationalString createInternationalString(Map<Locale,String> strings)
createInternationalString
in interface NameFactory
strings
- String value for each locale key.Types.toInternationalString(CharSequence)
public NameSpace createNameSpace(GenericName name, Map<String,?> properties)
This method can receive an optional map of properties. Recognized entries are:
Property name | Purpose |
---|---|
"separator" |
The separator to insert between
parsed names in that namespace.
For HTTP namespace, it is "." .
For URN namespace, it is typically ":" . |
"separator.head" |
The separator to insert between the namespace and the
head. For HTTP namespace, it is "://" .
For URN namespace, it is typically ":" . If this entry is omitted, then
the default is the same value than the "separator" entry. |
createNameSpace
in interface NameFactory
name
- The name of the namespace to be returned. This argument can be created using
createGenericName(null, parsedNames)
.properties
- An optional map of properties to be assigned to the namespace, or null
if none.public TypeName createTypeName(NameSpace scope, CharSequence name)
DefaultTypeName
instance.createTypeName
in interface NameFactory
scope
- The scope of the type
name to be created, or null
for a global namespace.name
- The type name as a string or an international string.NullArgumentException
- If the name
argument is null.public MemberName createMemberName(NameSpace scope, CharSequence name, TypeName attributeType)
DefaultMemberName
instance.scope
- The scope of the member
name to be created, or null
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.NullArgumentException
- If the name
or attributeType
argument is null.public LocalName createLocalName(NameSpace scope, CharSequence name)
DefaultLocalName
instance.createLocalName
in interface NameFactory
scope
- The scope of the local
name to be created, or null
for a global namespace.name
- The local name as a string or an international string.NullArgumentException
- If the name
argument is null.public GenericName createGenericName(NameSpace scope, CharSequence... parsedNames)
DefaultLocalName
if the length of the parsedNames
array is 1, or an instance of DefaultScopedName
if the length of the array is 2
or more.createGenericName
in interface NameFactory
scope
- The scope of the generic name to be created,
or null
for a global namespace.parsedNames
- The local names as an array of String
or InternationalString
instances.
This array shall contain at least one element.NullArgumentException
- If the given array is empty.public GenericName parseGenericName(NameSpace scope, CharSequence name)
':'
separator if the given scope is null.parseGenericName
in interface NameFactory
scope
- The scope of the generic name to
be created, or null
for a global namespace.name
- The qualified name, as a sequence of names separated by a scope-dependent
separator.Copyright © 2010–2014 The Apache Software Foundation. All rights reserved.