Class CodeLists

java.lang.Object
org.apache.sis.internal.util.CodeLists
All Implemented Interfaces:
org.opengis.util.CodeList.Filter

public final class CodeLists extends Object implements org.opengis.util.CodeList.Filter
Implementation of some Types methods needed by sis-utility module. This class opportunistically implements CodeList.Filter interface, but this should be considered an implementation details.
Since:
1.0
Version:
1.0
Author:
Martin Desruisseaux (Geomatys)
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The name of bundle resources for code list titles.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    accept(org.opengis.util.CodeList<?> code)
    Returns true if the given code matches the name we are looking for.
    Returns the name of the code to create, or null if no new code list shall be created.
    static <T extends Enum<T>>
    T
    forName(Class<T> enumType, String name)
    Returns the enumeration value of the given type that matches the given name, or null if none.
    static <T extends org.opengis.util.CodeList<T>>
    T
    forName(Class<T> codeType, String name, boolean canCreate)
    Returns the code of the given type that matches the given name, or optionally returns a new one if none match the name.
    static <T extends org.opengis.util.CodeList<?>>
    T[]
    values(Class<T> codeType)
    Returns all known values for the given type of code list or enumeration.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • RESOURCES

      public static final String RESOURCES
      The name of bundle resources for code list titles. The resources should be loaded with the same class loader than org.opengis.annotation.UML.class.getClassLoader(). Keys are CodeList.identifier().
      See Also:
  • Method Details

    • codename

      public String codename()
      Returns the name of the code to create, or null if no new code list shall be created.
      Specified by:
      codename in interface org.opengis.util.CodeList.Filter
      Returns:
      the name specified at construction time.
    • accept

      public boolean accept(org.opengis.util.CodeList<?> code)
      Returns true if the given code matches the name we are looking for.
      Specified by:
      accept in interface org.opengis.util.CodeList.Filter
      Parameters:
      code - the code list candidate.
    • forName

      public static <T extends org.opengis.util.CodeList<T>> T forName(Class<T> codeType, String name, boolean canCreate)
      Returns the code of the given type that matches the given name, or optionally returns a new one if none match the name.
      Type Parameters:
      T - the compile-time type given as the codeType parameter.
      Parameters:
      codeType - the type of code list.
      name - the name of the code to obtain, or null.
      canCreate - true if this method is allowed to create new code.
      Returns:
      a code matching the given name, or null.
      See Also:
    • forName

      public static <T extends Enum<T>> T forName(Class<T> enumType, String name)
      Returns the enumeration value of the given type that matches the given name, or null if none.
      Type Parameters:
      T - the compile-time type given as the enumType parameter.
      Parameters:
      enumType - the type of enumeration.
      name - the name of the enumeration value to obtain, or null.
      Returns:
      a value matching the given name, or null.
      See Also:
    • values

      public static <T extends org.opengis.util.CodeList<?>> T[] values(Class<T> codeType)
      Returns all known values for the given type of code list or enumeration.
      Type Parameters:
      T - the compile-time type given as the codeType parameter.
      Parameters:
      codeType - the type of code list or enumeration.
      Returns:
      the list of values for the given code list or enumeration, or an empty array if none.
      See Also: