Interface OslcErrors.ErrorId

  • Enclosing class:
    OslcErrors

    public static interface OslcErrors.ErrorId
    An identifier that uniquely identifies an error in the whole application. Such identifier is associated to an OSLC Error resource and is the key for the end user to search for corresponding documentation and to report to its support. An error identifier should be used at one location only in source code, so that it precisely indicates the case that made an error to occur.
    Since:
    1.13.0
    • Method Detail

      • getValue

        String getValue()
        Returns the unique identifier value, e.g. OCFD-SRV001.
        Returns:
        the unique identifier value.
      • formatValue

        default String formatValue​(String prefix,
                                   int id)
        Returns an identifier that combines the given prefix with the numeric identifier (formatted to use three characters).
        Parameters:
        prefix - an identifier prefix, e.g. OCFD-SRV
        id - a numeric value, e.g. 1
        Returns:
        an identifier that combines the information, e.g. OCFD-SRV001.
      • checkUniqueness

        static void checkUniqueness​(OslcErrors.ErrorId... identifiers)
        Ensures all given identifiers are unique and throw an exception if it's not the case, as it is considered a developer error. This method shall be called from the static initialization block of the Java Enum implementing this interface, to verify the developer did not make a mistake when adding a new literal.
        Parameters:
        identifiers - the identifiers of the Java Enum implementing this interface.
        Throws:
        IllegalStateException - if any identifier is not unique.