public final class FacetChecker
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
checkAtom(java.lang.String atom)
Checks whether an atom is valid.
|
static java.lang.String |
checkFacetName(java.lang.String name)
Checks whether a facet name is valid.
|
static java.lang.String |
checkFacetName(java.lang.String name,
java.lang.String callerContext)
Checks whether a facet name is valid.
|
static DocumentPb.FacetValue |
checkFacetValue(DocumentPb.FacetValue value)
Checks whether a facet value is valid.
|
static java.lang.Double |
checkNumber(java.lang.Double value)
Checks whether a number is valid.
|
static DocumentPb.Facet |
checkValid(DocumentPb.Facet facet) |
public static java.lang.String checkFacetName(java.lang.String name)
SearchApiLimits.MAXIMUM_NAME_LENGTH
inclusive, and it should match
SearchApiLimits#FACET_NAME_PATTERN
.name
- the facet name to checkjava.lang.IllegalArgumentException
- if the facet name is null or empty
or is longer than SearchApiLimits#MAXIMUM_NAME_LENGTH or it doesn't
match #FACET_NAME_PATTERN.public static java.lang.String checkFacetName(java.lang.String name, java.lang.String callerContext)
SearchApiLimits.MAXIMUM_NAME_LENGTH
inclusive, and it should match
SearchApiLimits#FACET_NAME_PATTERN
.name
- the facet name to checkcallerContext
- the caller context used for creating error message in case of a failure.java.lang.IllegalArgumentException
- if the facet name is null or empty
or is longer than SearchApiLimits#MAXIMUM_NAME_LENGTH or it doesn't
match #FACET_NAME_PATTERN.public static java.lang.String checkAtom(java.lang.String atom)
atom
- the atom to checkjava.lang.IllegalArgumentException
- if atom is too long or too short (i.e. empty)public static java.lang.Double checkNumber(java.lang.Double value)
SearchApiLimits.MINIMUM_NUMBER_VALUE
and SearchApiLimits.MAXIMUM_NUMBER_VALUE
,
inclusive.value
- the value to checkjava.lang.IllegalArgumentException
- if number is out of rangepublic static DocumentPb.FacetValue checkFacetValue(DocumentPb.FacetValue value)
value
- the facet value to checkjava.lang.IllegalArgumentException
- if the facet value type is not recognized or
if the facet value string is not valid based on the type. See checkNumber(java.lang.Double)
and checkAtom(java.lang.String)
.public static DocumentPb.Facet checkValid(DocumentPb.Facet facet)