FacetChecker (Google App Engine API for Java)

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.Object
    Provides 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.String checkAtom(java.lang.String value)
      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) 
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 and SearchApiLimits.MAXIMUM_NAME_LENGTH inclusive, and it should match SearchApiLimits.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 and SearchApiLimits.MAXIMUM_NAME_LENGTH inclusive, and it should match SearchApiLimits.FIELD_NAME_PATTERN.
        Parameters:
        name - the facet name to check
        callerContext - 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 between SearchApiLimits.MINIMUM_NUMBER_VALUE and SearchApiLimits.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. See checkNumber(java.lang.Double) and checkAtom(java.lang.String).
      • checkValid

        public static DocumentPb.Facet checkValid(DocumentPb.Facet facet)