Interface NameFactory

All Superinterfaces:
Factory

public interface NameFactory extends Factory
Factory for generic names and international strings.
Note: despite the "create(…)" method names, implementations may return cached instances.
Since:
2.0
Departure from OGC/ISO abstract specification:
Addition of element not in the ISO/OGC specification Added in order to provide constructors for GenericName and related interfaces.
  • Method Details

    • createInternationalString

      InternationalString createInternationalString(Map<Locale,String> strings)
      Creates an international string from a set of strings in different locales.
      Parameters:
      strings - string value for each locale key.
      Returns:
      the international string.
    • createNameSpace

      NameSpace createNameSpace(GenericName name, Map<String,?> properties)
      Creates a namespace having the given name and separators. The properties argument is optional: if non-null, the given properties may be given to the namespace to be created. The properties can include for example the separator character to be used between the parsed names.

      Implementations are encouraged to recognize at least the properties listed in the following table. Additional implementation-specific properties can be added. Unknown properties shall be ignored.

      Keys for additional standard 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 than "separator".
      Examples:
      • For URN namespace, separator = ":" is typically sufficient.
      • For HTTP namespace, separator.head = "://" and separator = ".".
      Parameters:
      name - the name of the namespace to be returned. This argument can be created using createGenericName(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 separators.
    • createTypeName

      TypeName createTypeName(NameSpace scope, CharSequence name)
      Creates a type name from the given character sequence and automatically inferred Java type. The character sequence shall complies to the same restriction than createLocalName(…).
      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.
      Returns:
      the type name for the given scope and character sequence.
    • createTypeName

      TypeName createTypeName(NameSpace scope, CharSequence name, Type javaType)
      Creates a type name from the given character sequence and explicit Java type. The javaType argument specifies the value to be returned by TypeName.toJavaType(), which may be absent.
      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.
      javaType - 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:
      3.1
      See Also:
    • createMemberName

      MemberName createMemberName(NameSpace scope, CharSequence name, TypeName attributeType)
      Creates a member name from the given character sequence and attribute type.
      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.
      attributeType - the type of the data associated with the record member.
      Returns:
      the member name for the given scope, character sequence and type name.
      Since:
      3.1
    • createLocalName

      LocalName createLocalName(NameSpace scope, CharSequence name)
      Creates a local name from the given character sequence. The character sequence can be either a String or an InternationalString instance. In the latter case, implementations can use an arbitrary locale (typically Locale.ROOT) for the unlocalized string to be returned by LocalName.toString().
      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 scope and character sequence.
    • createGenericName

      GenericName createGenericName(NameSpace scope, CharSequence... parsedNames)
      Creates a local or scoped name from an array of parsed names. The array elements can be either String or InternationalString instances. In the latter case, implementations can use an arbitrary locale (typically Locale.ROOT) for the unlocalized string to be returned by LocalName.toString().

      If the length of the parsedNames array is 1, then this method returns an instance of LocalName. If the length is 2 or more, then this method returns an instance of ScopedName.

      Parameters:
      scope - the scope of the generic name to create, or null 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

      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 an implementation-dependent default separator if the given scope is null.

      For example, if the scope argument is the namespace "urn:ogc:def" with ":" as the separator, and if the name argument is the string "crs:epsg:4326", then the result is a scoped name having a depth of 3, which is the length of the list of parsed names ("crs", "epsg", "4326").

      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.