Package com.fauna.response
Class ConstraintFailure
- java.lang.Object
-
- com.fauna.response.ConstraintFailure
-
public final class ConstraintFailure extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ConstraintFailure.Builder
static class
ConstraintFailure.PathElement
-
Constructor Summary
Constructors Constructor Description ConstraintFailure(java.lang.String message, java.lang.String name, ConstraintFailure.PathElement[][] paths)
Initialize a new ConstraintFailure instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ConstraintFailure.Builder
builder()
Initializes a new empty Builder.static ConstraintFailure.PathElement[]
createPath(java.lang.Object... elements)
Constructs a PathElement[] from the provided objects.boolean
equals(java.lang.Object other)
java.lang.String
getMessage()
Gets the constraint failure message.java.util.Optional<java.lang.String>
getName()
Gets the constraint failure name.java.util.Optional<ConstraintFailure.PathElement[][]>
getPaths()
Gets an optional path elements related to the constraint failure.java.util.Optional<java.util.List<java.lang.String>>
getPathStrings()
Gets a list of string representations of the constraint failure paths.int
hashCode()
static ConstraintFailure
parse(com.fasterxml.jackson.core.JsonParser parser)
Builds a ConstraintFailure instance from the provided JsonParser.boolean
pathsAreEqual(ConstraintFailure otherFailure)
Tests path equality with another ConstraintFailure.
-
-
-
Constructor Detail
-
ConstraintFailure
public ConstraintFailure(java.lang.String message, java.lang.String name, ConstraintFailure.PathElement[][] paths)
Initialize a new ConstraintFailure instance. Queries that fail a check or unique constraint return a constraint failure.- Parameters:
message
- Human-readable description of the constraint failure.name
- Name of the failed constraint.paths
- A list of paths where the constraint failure occurred.
-
-
Method Detail
-
createPath
public static ConstraintFailure.PathElement[] createPath(java.lang.Object... elements)
Constructs a PathElement[] from the provided objects. Supported types are String and Integer.- Parameters:
elements
- The String objects or Integer objects to use.- Returns:
- A array of PathElement instances.
-
builder
public static ConstraintFailure.Builder builder()
Initializes a new empty Builder.- Returns:
- A new Builder
-
parse
public static ConstraintFailure parse(com.fasterxml.jackson.core.JsonParser parser) throws java.io.IOException
Builds a ConstraintFailure instance from the provided JsonParser.- Parameters:
parser
- The JsonParser to consume.- Returns:
- A new ConstraintFailure instance.
- Throws:
java.io.IOException
- Thrown if an error is encountered while reading the parser.
-
getMessage
public java.lang.String getMessage()
Gets the constraint failure message.- Returns:
- A string representation of the message.
-
getName
public java.util.Optional<java.lang.String> getName()
Gets the constraint failure name.- Returns:
- A string representation of the name.
-
getPaths
public java.util.Optional<ConstraintFailure.PathElement[][]> getPaths()
Gets an optional path elements related to the constraint failure.- Returns:
- An array of arrays of PathElements.
-
getPathStrings
public java.util.Optional<java.util.List<java.lang.String>> getPathStrings()
Gets a list of string representations of the constraint failure paths.- Returns:
- A list of string representations of constraint failure paths.
-
pathsAreEqual
public boolean pathsAreEqual(ConstraintFailure otherFailure)
Tests path equality with another ConstraintFailure.- Parameters:
otherFailure
- The other ConstraintFailure.- Returns:
- True if the paths are equal.
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-