DefaultNameFactory (Apache SIS 1.6 API) JavaScript is disabled on your browser.     Skip navigation links Overview Class Use Tree New Deprecated Index Search Help org.apache.sis.metadata org.apache.sis.util.iso DefaultNameFactory Contents  Description Thread safety Constructor Summary Method Summary Constructor Details DefaultNameFactory() Method Details provider() createInternationalString(Map) createNameSpace(GenericName, Map) createTypeName(NameSpace, CharSequence) createTypeName(NameSpace, CharSequence, Type) createMemberName(NameSpace, CharSequence, TypeName) createLocalName(NameSpace, CharSequence) createGenericName(NameSpace, CharSequence...) parseGenericName(NameSpace, CharSequence) toGenericNames(Object) toTypeName(Class) Hide sidebar  Show sidebar Class DefaultNameFactory Object AbstractFactory DefaultNameFactory All Implemented Interfaces: Factory, Name­Factory public class DefaultNameFactory extends AbstractFactory implements NameFactory A factory for creating Abstract­Name objects. This factory provides the following methods for creating name instances: create­Type­Name(Name­Space, Char­Sequence) create­Member­Name(Name­Space, Char­Sequence, Type­Name) create­Local­Name(Name­Space, Char­Sequence) create­Generic­Name(Name­Space, Char­Sequence[]) – for local or scoped names The following methods for creating miscellaneous name-related objects: create­Name­Space(Generic­Name, Map) create­International­String(Map) And the following methods for performing some analysis: parse­Generic­Name(Name­Space, Char­Sequence) to­Generic­Names(Object) to­Type­Name(Class) Thread safety The same Default­Name­Factory 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. Since: 0.3 See Also: Names Default­Name­Space Default­Scoped­Name Default­Local­Name Default­Type­Name Default­Member­Name Constructor Summary Constructors Constructor Description Default­Name­Factory() Creates a new factory. Method Summary All MethodsStatic MethodsInstance MethodsConcrete Methods Modifier and Type Method Description Generic­Name create­Generic­Name(Name­Space scope, Char­Sequence... parsed­Names) Creates a local or scoped name from an array of parsed names. International­String create­International­String(Map<Locale,String> strings) Creates an international string from a set of strings in different locales. Local­Name create­Local­Name(Name­Space scope, Char­Sequence name) Creates a local name from the given character sequence. Member­Name create­Member­Name(Name­Space scope, Char­Sequence name, Type­Name attribute­Type) Creates a member name from the given character sequence and attribute type. Name­Space create­Name­Space(Generic­Name name, Map<String,?> properties) Returns a namespace having the given name. Type­Name create­Type­Name(Name­Space scope, Char­Sequence name) Creates a type name from the given character sequence and automatically inferred Java type. Type­Name create­Type­Name(Name­Space scope, Char­Sequence name, Type java­Type) Creates a type name from the given character sequence and explicit Java type. Generic­Name parse­Generic­Name(Name­Space scope, Char­Sequence name) Constructs a generic name from a qualified name. static Default­Name­Factory provider() Returns the default provider of Generic­Name instances. Generic­Name[] to­Generic­Names(Object value) Converts the given value to an array of generic names. Type­Name to­Type­Name(Class<?> value­Class) Suggests a type name for the given class. Methods inherited from class AbstractFactory get­Vendor, to­String Methods inherited from class Object clone, equals, finalize, get­Class, hash­Code, notify, notify­All, wait, wait, wait Constructor Details DefaultNameFactory public DefaultNameFactory() Creates a new factory. See Also: provider() Method Details provider public static DefaultNameFactory provider() Returns the default provider of Generic­Name instances. This is the factory used by the Apache SIS library when no non-null Name­Factory has been explicitly specified. This method can be invoked directly, or indirectly through Service­Loader​.load(Name­Factory​.class). Returns: the default provider of generic names. Since: 1.4 See Also: Service­Loader createInternationalString public InternationalString createInternationalString(Map<Locale,String> strings) Creates an international string from a set of strings in different locales. Specified by: create­International­String in interface Name­Factory Parameters: strings - string value for each locale key. Returns: the international string. See Also: Types​.to­International­String(Char­Sequence) createNameSpace public NameSpace createNameSpace(GenericName name, Map<String,?> properties) Returns a namespace having the given name. Despite the "create" name, this method tries to return an existing instance when possible. The namespace is characterized by the given name, and optionally by the following properties: Recognized properties Property name Purpose "separator" The separator to insert between parsed names in that namespace. "separator.head" The separator to insert between the namespace and the head. If omitted, then the default is the same value as "separator". Examples For URN namespace, separator = ":" is typically sufficient. For HTTP namespace, separator​.head = "://" and separator = ".". Specified by: create­Name­Space in interface Name­Factory Parameters: name - the name of the namespace to be returned. This argument can be created using create­Generic­Name(null, namespace). properties - an optional map of properties to be assigned to the namespace, or null if none. Returns: a namespace having the given name and separator. See Also: Names​.create­Local­Name(Char­Sequence, String, Char­Sequence) createTypeName public TypeName createTypeName(NameSpace scope, CharSequence name) throws UnknownNameException Creates a type name from the given character sequence and automatically inferred Java type. The default implementation returns a new or an existing Default­Type­Name instance. See Default­Type­Name javadoc for the list of recognized type names. Specified by: create­Type­Name in interface Name­Factory Parameters: scope - the scope of the type name create, or null for a global namespace. name - the type name as a string or an international string. Returns: the type name for the given scope and character sequence. Throws: Unknown­Name­Exception - if a mapping from the name to a Java class was expected to exist (because the specified scope is "OGC" or "class") but the associated Java class cannot be found. See Also: to­Type­Name(Class) Default­Type­Name(Name­Space, Char­Sequence) Names​.create­Type­Name(Char­Sequence, String, Char­Sequence) createTypeName public TypeName createTypeName(NameSpace scope, CharSequence name, Type javaType) Creates a type name from the given character sequence and explicit Java type. The default implementation returns a new or an existing Default­Type­Name instance. Parameters: scope - the scope of the type name to create, or null for a global namespace. name - the type name as a string or an international string. java­Type - the Java type represented by the name, or null if none. Returns: the type name for the given scope, character sequence and Java type. Since: 1.3 See Also: to­Type­Name(Class) Default­Type­Name(Name­Space, Char­Sequence, Type) createMemberName public MemberName createMemberName(NameSpace scope, CharSequence name, TypeName attributeType) Creates a member name from the given character sequence and attribute type. The default implementation returns a new or an existing Default­Member­Name instance. Parameters: scope - the scope of the member name to create, or null for a global namespace. name - the member name as a string or an international string. attribute­Type - the type of the data associated with the member. Returns: the member name for the given character sequence. See Also: Names​.create­Member­Name(Char­Sequence, String, Char­Sequence, Type­Name) Names​.create­Member­Name(Char­Sequence, String, Char­Sequence, Class) createLocalName public LocalName createLocalName(NameSpace scope, CharSequence name) Creates a local name from the given character sequence. The default implementation returns a new or an existing Default­Local­Name instance. Specified by: create­Local­Name in interface Name­Factory Parameters: scope - the scope of the local name to create, or null for a global namespace. name - the local name as a string or an international string. Returns: the local name for the given character sequence. See Also: Names​.create­Local­Name(Char­Sequence, String, Char­Sequence) createGenericName public GenericName createGenericName(NameSpace scope, CharSequence... parsedNames) Creates a local or scoped name from an array of parsed names. The default implementation returns an instance of Default­Local­Name if the length of the parsed­Names array is 1, or an instance of Default­Scoped­Name if the length of the array is 2 or more. Specified by: create­Generic­Name in interface Name­Factory Parameters: scope - the scope of the generic name to create, or null for a global namespace. parsed­Names - the local names as an array of String or International­String instances. This array shall contain at least one element. Returns: the generic name for the given parsed names. See Also: parse­Generic­Name(Name­Space, Char­Sequence) 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 the ':' separator if the given scope is null. Specified by: parse­Generic­Name in interface Name­Factory Parameters: scope - the scope of the generic name to create, or null 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. See Also: Names​.parse­Generic­Name(Char­Sequence, String, Char­Sequence) toGenericNames public GenericName[] toGenericNames(Object value) throws ClassCastException Converts the given value to an array of generic names. If the given value is an instance of Generic­Name, String or any other type enumerated below, then it is converted and returned in an array of length 1. If the given value is an array or a collection, then an array of same length is returned where each element has been converted. Allowed types or element types are: Generic­Name, to be cast and returned as-is. Char­Sequence (usually a String or an International­String), to be parsed as a generic name using the ':' separator. Identifier, its code to be parsed as a generic name using the ':' separator. If value is an array or a collection containing null elements, then the corresponding element in the returned array will also be null. Parameters: value - the object to cast into an array of generic names, or null. Returns: the generic names, or null if the given value was null. Note that it may be the value reference itself cast to Generic­Name[]. Throws: Class­Cast­Exception - if value cannot be cast. Since: 0.5 toTypeName public TypeName toTypeName(Class<?> valueClass) Suggests a type name for the given class. Apache SIS provides a mapping between Class and Type­Name objects as documented in the Default­Type­Name javadoc. The given value­Class can be fetched back by Default­Type­Name​.to­Java­Type(). Parameters: value­Class - the Java class for which to get a type name, or null. Returns: a suggested type name, or null if the given class was null. Since: 0.5 See Also: Default­Type­Name​.to­Java­Type() Names​.to­Class(Type­Name) Names​.create­Type­Name(Class)