Enum CodeType

java.lang.Object
java.lang.Enum<CodeType>
org.apache.sis.internal.storage.CodeType
All Implemented Interfaces:
Serializable, Comparable<CodeType>, java.lang.constant.Constable

public enum CodeType extends Enum<CodeType>
Heuristic rules for determining whether an authority code seems to be actually a file path, or a code defined in the URN namespace, or a simple code.
Since:
0.8
Version:
0.8
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    The code is a filename like "/path/to/file" or "C:\path\to\file".
    The code is an URL in the "http://www.opengis.net" namespace.
    The code is not defined in the URN namespace but is nevertheless presumed to be an authority code.
    Cannot resolve whether the code is a local file like "myfile.wkt" or an identifier without authority like "4326".
    The code is a URL like "http:" or "file:", with the exception of HTTP in the "www.opengis.net" domain.
    The code is an authority code defined in the "urn:" namespace.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final Map<String,CodeType>
    The types for a list of known protocols.
    final boolean
    Whether the code may be understood by the CRS.forCode(String).
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    CodeType(boolean isCRS)
    Creates a new enum value.
  • Method Summary

    Modifier and Type
    Method
    Description
    static CodeType
    guess(String codeOrPath)
    Infers the type for the given authority code.
    static CodeType
    Returns the enum constant of this type with the specified name.
    static CodeType[]
    Returns an array containing the constants of this enum type, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • FILE

      public static final CodeType FILE
      The code is a filename like "/path/to/file" or "C:\path\to\file". Could also be a directory name.
    • URL

      public static final CodeType URL
      The code is a URL like "http:" or "file:", with the exception of HTTP in the "www.opengis.net" domain. The latter case is identified by HTTP_OGC instead of this enum.
    • URN

      public static final CodeType URN
      The code is an authority code defined in the "urn:" namespace.
    • HTTP_OGC

      public static final CodeType HTTP_OGC
      The code is an URL in the "http://www.opengis.net" namespace.
    • IDENTIFIER

      public static final CodeType IDENTIFIER
      The code is not defined in the URN namespace but is nevertheless presumed to be an authority code. Example: "EPSG:4326".
    • UNKNOWN

      public static final CodeType UNKNOWN
      Cannot resolve whether the code is a local file like "myfile.wkt" or an identifier without authority like "4326". Such code without cannot be decoded by CRS.forCode(String), but may be understood by a more specific authority factory.
  • Field Details

    • isCRS

      public final boolean isCRS
      Whether the code may be understood by the CRS.forCode(String). A value of true does not guaranteed the the code is valid. It only said that there is some chances that the code is valid.
    • FOR_PROTOCOL

      private static final Map<String,CodeType> FOR_PROTOCOL
      The types for a list of known protocols. Protocol must be lower-cases.

      This map is used for resolving ambiguity between "PROTOCOL:FILE" and "AUTHORITY:CODE". If the given path begins with a file separator like "PROTOCOL:/PATH/FILE", then the path is presumed to be a URL even if the protocol is not in this map.

  • Constructor Details

    • CodeType

      private CodeType(boolean isCRS)
      Creates a new enum value.
  • Method Details

    • values

      public static CodeType[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static CodeType valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null
    • guess

      public static CodeType guess(String codeOrPath)
      Infers the type for the given authority code.
      Parameters:
      codeOrPath - the code or file path.
      Returns:
      whether the given argument seems to be a file path, URL, URN of authority code.