Class FacetChecker (2.0.0)

public final class FacetChecker

Provides checks for Facet names and values: atom or number.

Inheritance

java.lang.Object > FacetChecker

Static Methods

checkAtom(String value)

public static String checkAtom(String value)

Checks whether an atom is valid. An atom can be null or a string between 1 and SearchApiLimits.MAXIMUM_ATOM_LENGTH in length, inclusive.

Parameter
NameDescription
valueString

the atom value to check

Returns
TypeDescription
String

the checked atom

checkFacetName(String name)

public static String checkFacetName(String name)

Checks whether a facet name is valid. The facet name length must be between 1 and SearchApiLimits#MAXIMUM_NAME_LENGTH inclusive, and it should match SearchApiLimits#FIELD_NAME_PATTERN.

Parameter
NameDescription
nameString

the facet name to check

Returns
TypeDescription
String

the checked facet name

checkFacetName(String name, String callerContext)

public static String checkFacetName(String name, String callerContext)

Checks whether a facet name is valid. The facet name length must be between 1 and SearchApiLimits#MAXIMUM_NAME_LENGTH inclusive, and it should match SearchApiLimits#FIELD_NAME_PATTERN.

Parameters
NameDescription
nameString

the facet name to check

callerContextString

the caller context used for creating error message in case of a failure.

Returns
TypeDescription
String

the checked facet name

checkFacetValue(DocumentPb.FacetValue value)

public static DocumentPb.FacetValue checkFacetValue(DocumentPb.FacetValue value)

Checks whether a facet value is valid.

Parameter
NameDescription
valuecom.google.apphosting.api.search.DocumentPb.FacetValue

the facet value to check

Returns
TypeDescription
com.google.apphosting.api.search.DocumentPb.FacetValue

the checked facet value

checkNumber(Double value)

public static Double checkNumber(Double value)

Checks whether a number is valid. A number can be null or a value between SearchApiLimits#MINIMUM_NUMBER_VALUE and SearchApiLimits#MAXIMUM_NUMBER_VALUE, inclusive.

Parameter
NameDescription
valueDouble

the value to check

Returns
TypeDescription
Double

the checked number

checkValid(DocumentPb.Facet facet)

public static DocumentPb.Facet checkValid(DocumentPb.Facet facet)
Parameter
NameDescription
facetcom.google.apphosting.api.search.DocumentPb.Facet
Returns
TypeDescription
com.google.apphosting.api.search.DocumentPb.Facet