Class FieldLocation
- java.lang.Object
-
- org.assertj.core.api.recursive.comparison.FieldLocation
-
- All Implemented Interfaces:
java.lang.Comparable<FieldLocation>
public final class FieldLocation extends java.lang.Object implements java.lang.Comparable<FieldLocation>
Represents the path to a given field. Immutable
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<java.lang.String>
decomposedPath
private java.lang.String
pathToUseInRules
-
Constructor Summary
Constructors Constructor Description FieldLocation(java.lang.String s)
FieldLocation(java.util.List<java.lang.String> path)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(FieldLocation other)
boolean
equals(java.lang.Object obj)
FieldLocation
field(java.lang.String field)
java.util.List<java.lang.String>
getDecomposedPath()
java.lang.String
getFieldName()
java.lang.String
getPathToUseInErrorReport()
java.lang.String
getPathToUseInRules()
boolean
hasChild(FieldLocation child)
Returns true if this field has the given child (direct or indirect), false otherwise.int
hashCode()
boolean
hasParent(FieldLocation parent)
Returns true if this has the given parent (direct or indirect), false otherwise.boolean
matches(java.lang.String fieldPath)
boolean
matches(FieldLocation field)
private static java.lang.String
pathToUseInRules(java.util.List<java.lang.String> path)
static FieldLocation
rootFieldLocation()
java.lang.String
shortDescription()
java.lang.String
toString()
-
-
-
Method Detail
-
matches
public boolean matches(FieldLocation field)
-
matches
public boolean matches(java.lang.String fieldPath)
-
getDecomposedPath
public java.util.List<java.lang.String> getDecomposedPath()
-
getPathToUseInRules
public java.lang.String getPathToUseInRules()
-
field
public FieldLocation field(java.lang.String field)
-
compareTo
public int compareTo(FieldLocation other)
- Specified by:
compareTo
in interfacejava.lang.Comparable<FieldLocation>
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
shortDescription
public java.lang.String shortDescription()
-
pathToUseInRules
private static java.lang.String pathToUseInRules(java.util.List<java.lang.String> path)
-
getPathToUseInErrorReport
public java.lang.String getPathToUseInErrorReport()
-
getFieldName
public java.lang.String getFieldName()
-
rootFieldLocation
public static FieldLocation rootFieldLocation()
-
hasParent
public boolean hasParent(FieldLocation parent)
Returns true if this has the given parent (direct or indirect), false otherwise.Examples:
| field | parent | hasParent? ----------------------------------------------- | "name.first" | "name" | true | "name.first.nickname" | "name" | true | "name.first.nickname" | "name.first" | true | "name" | "name" | false | "names" | "name" | false | "nickname" | "name" | false | "name" | "nickname" | false | "first.nickname" | "name" | false
- Parameters:
parent
- the field to check for being a parent- Returns:
- true if this has the given parent (direct or indirect), false otherwise.
-
hasChild
public boolean hasChild(FieldLocation child)
Returns true if this field has the given child (direct or indirect), false otherwise.Examples:
| field | child | hasChild? ----------------------------------------------- | "name" | "name.first" | true | "name" | "name.last" | true | "one" | "one.two.three" | true | "name.first" | "name " | false | "name" | "name" | false | "names" | "name" | false | "nickname" | "name" | false | "name" | "nickname" | false | "first.nickname" | "name" | false
- Parameters:
child
- the field to check for being a child- Returns:
- true if this has the given child (direct or indirect), false otherwise.
-
-