com.google.appengine.api.search.checkers
Class FacetChecker
- java.lang.Object
-
- com.google.appengine.api.search.checkers.FacetChecker
-
public final class FacetChecker extends java.lang.ObjectProvides checks for Facet names and values: atom or number.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static java.lang.StringcheckAtom(java.lang.String value)Checks whether an atom is valid.static java.lang.StringcheckFacetName(java.lang.String name)Checks whether a facet name is valid.static java.lang.StringcheckFacetName(java.lang.String name, java.lang.String callerContext)Checks whether a facet name is valid.static DocumentPb.FacetValuecheckFacetValue(DocumentPb.FacetValue value)Checks whether a facet value is valid.static java.lang.DoublecheckNumber(java.lang.Double value)Checks whether a number is valid.static DocumentPb.FacetcheckValid(DocumentPb.Facet facet)
-
-
-
Method Detail
-
checkFacetName
public static java.lang.String checkFacetName(java.lang.String name)
Checks whether a facet name is valid. The facet name length must be between 1 andSearchApiLimits.MAXIMUM_NAME_LENGTHinclusive, and it should matchSearchApiLimits.FIELD_NAME_PATTERN.- Parameters:
name- the facet name to check- Returns:
- the checked facet name
- Throws:
java.lang.IllegalArgumentException- if the facet name is null or empty or is longer than SearchApiLimits#MAXIMUM_NAME_LENGTH or it doesn't match #FIELD_NAME_PATTERN.
-
checkFacetName
public static java.lang.String checkFacetName(java.lang.String name, java.lang.String callerContext)Checks whether a facet name is valid. The facet name length must be between 1 andSearchApiLimits.MAXIMUM_NAME_LENGTHinclusive, and it should matchSearchApiLimits.FIELD_NAME_PATTERN.- Parameters:
name- the facet name to checkcallerContext- the caller context used for creating error message in case of a failure.- Returns:
- the checked facet name
- Throws:
java.lang.IllegalArgumentException- if the facet name is empty or is longer than SearchApiLimits#MAXIMUM_NAME_LENGTH or it doesn't match #FIELD_NAME_PATTERN.
-
checkAtom
public static java.lang.String checkAtom(java.lang.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.- Parameters:
value- the atom value to check- Returns:
- the checked atom
- Throws:
java.lang.IllegalArgumentException- if atom is too long or too short (i.e. empty)
-
checkNumber
public static java.lang.Double checkNumber(java.lang.Double value)
Checks whether a number is valid. A number can be null or a value betweenSearchApiLimits.MINIMUM_NUMBER_VALUEandSearchApiLimits.MAXIMUM_NUMBER_VALUE, inclusive.- Parameters:
value- the value to check- Returns:
- the checked number
- Throws:
java.lang.IllegalArgumentException- if number is out of range
-
checkFacetValue
public static DocumentPb.FacetValue checkFacetValue(DocumentPb.FacetValue value)
Checks whether a facet value is valid.- Parameters:
value- the facet value to check- Returns:
- the checked facet value
- Throws:
java.lang.IllegalArgumentException- if the facet value type is not recognized or if the facet value string is not valid based on the type. SeecheckNumber(java.lang.Double)andcheckAtom(java.lang.String).
-
checkValid
public static DocumentPb.Facet checkValid(DocumentPb.Facet facet)
-
-