Class SubdocOperationResult<OPERATION>

    • Method Detail

      • createFatal

        public static <OPERATION> SubdocOperationResult<OPERATION> createFatal​(String path,
                                                                               OPERATION operation,
                                                                               RuntimeException fatal)
        Create a SubdocOperationResult that denotes that a fatal Exception occurred when parsing server-side result. The exception can be found as the value, and the status is ResponseStatus.FAILURE.
        Parameters:
        path - the path looked up.
        operation - the type of the operation which result couldn't be parsed.
        fatal - the Exception that occurred during response parsing.
        Returns:
        the fatal LookupResult.
      • createResult

        public static <OPERATION> SubdocOperationResult<OPERATION> createResult​(String path,
                                                                                OPERATION operation,
                                                                                ResponseStatus status,
                                                                                Object value)
        Create a SubdocOperationResult that corresponds to an operation that should return a content (including null) instead of throwing when calling DocumentFragment.content(String).
        Parameters:
        path - the path looked up.
        operation - the type of operation.
        status - the status of the operation.
        value - the value of the operation if applicable, null otherwise.
        Returns:
        the operation result.
      • createResult

        public static <OPERATION> SubdocOperationResult<OPERATION> createResult​(String path,
                                                                                OPERATION operation,
                                                                                ResponseStatus status,
                                                                                Object value,
                                                                                byte[] rawValue)
        Create a SubdocOperationResult that corresponds to an operation that should return a content (including null) instead of throwing when calling DocumentFragment.content(String). Additionally, the result can also contain a raw byte representation of the same content in serialized form.
        Parameters:
        path - the path looked up.
        operation - the type of operation.
        status - the status of the operation.
        value - the value of the operation if applicable, null otherwise.
        rawValue - the raw byte value of the operation if applicable, null otherwise.
        Returns:
        the operation result.
      • path

        public String path()
        Returns:
        the path that was looked up.
      • operation

        public OPERATION operation()
        Returns:
        the exact kind of lookup that was performed.
      • status

        public ResponseStatus status()
        Returns:
        the status of the lookup.
      • exists

        public boolean exists()
        Returns:
        true if the value existed (and might have associated value), false otherwise.
      • value

        public Object value()
        Returns: - the value retrieved by a successful GET. - null for an unsuccessful GET (see the status() for details). - true/false for an EXIST (equivalent to exists()). - a RuntimeException if the client side parsing of the result failed (isFatal()).
        Returns:
        the value
      • rawValue

        public byte[] rawValue()
        Returns the serialized form of the value of a successful GET, as an array of bytes, or null for any other case, including when the raw value isn't relevant.
        Returns:
        the serialized raw value, if available.
      • isFatal

        public boolean isFatal()
        Returns:
        true if there was a fatal error while processing the result on the client side, in which case value() returns an RuntimeException.