public final class FieldChecker
extends java.lang.Object
| Constructor and Description |
|---|
FieldChecker() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
checkAtom(java.lang.String atom)
Checks whether an atom is valid.
|
static java.util.Date |
checkDate(java.util.Date date)
Checks whether a date is within range.
|
static java.lang.String |
checkExpression(java.lang.String expression)
Checks whether a field expression is not null and is parsable.
|
static java.lang.String |
checkFieldName(java.lang.String name)
Checks whether a field name is valid.
|
static java.lang.String |
checkFieldName(java.lang.String name,
java.lang.String fieldName)
Checks whether a field name is valid.
|
static java.lang.String |
checkHTML(java.lang.String html)
Checks whether a html is valid.
|
static java.lang.Double |
checkNumber(java.lang.Double value)
Checks whether a number is valid.
|
static java.lang.String |
checkPrefix(java.lang.String prefix)
Checks whether a prefix field is valid.
|
static java.lang.String |
checkSortExpression(java.lang.String expression)
Checks whether a sort bexpression is not null and is parsable.
|
static java.lang.String |
checkText(java.lang.String text)
Checks whether a text is valid.
|
static DocumentPb.Field |
checkValid(DocumentPb.Field field) |
static java.util.List<java.lang.Double> |
checkVector(java.util.List<java.lang.Double> vector)
Checks whether a vector field is valid.
|
static java.util.Locale |
parseLocale(java.lang.String locale)
Returns a
Locale parsed from the given locale string. |
public static java.lang.String checkFieldName(java.lang.String name)
SearchApiLimits.MAXIMUM_NAME_LENGTH and it should match
SearchApiLimits.FIELD_NAME_PATTERN.name - the field name to checkjava.lang.IllegalArgumentException - if the field name is null or empty
or is longer than SearchApiLimits#MAXIMUM_NAME_LENGTH or it doesn't
match #FIELD_NAME_PATTERN.public static java.lang.String checkFieldName(java.lang.String name,
java.lang.String fieldName)
SearchApiLimits.MAXIMUM_NAME_LENGTH and it should match
SearchApiLimits.FIELD_NAME_PATTERN.name - the field name to checkfieldName - the name of the Java field name of the class where
name is checkedjava.lang.IllegalArgumentException - if the field name is null or empty
or is longer than Field.MAXIMUM_NAME_LENGTH or it doesn't
match #FIELD_NAME_PATTERN.public static java.lang.String checkText(java.lang.String text)
text - the text to checkjava.lang.IllegalArgumentException - if text is too longpublic static java.lang.String checkHTML(java.lang.String html)
html - the html to checkjava.lang.IllegalArgumentException - if html is too longpublic static java.lang.String checkAtom(java.lang.String atom)
atom - the atom to checkjava.lang.IllegalArgumentException - if atom is too longpublic static java.lang.String checkPrefix(java.lang.String prefix)
prefix - the prefix to checkjava.lang.IllegalArgumentException - if prefix is too longpublic static java.util.List<java.lang.Double> checkVector(java.util.List<java.lang.Double> vector)
vector - the vector to checkjava.lang.IllegalArgumentException - if vector is too long.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 java.util.Date checkDate(java.util.Date date)
throws java.lang.IllegalArgumentException
date - the date to checkjava.lang.IllegalArgumentException - if date is out of rangepublic static java.lang.String checkExpression(java.lang.String expression)
expression - the expression to checkjava.lang.IllegalArgumentException - if the expression is null, or
cannot be parsedpublic static java.lang.String checkSortExpression(java.lang.String expression)
expression - the expression to checkjava.lang.IllegalArgumentException - if the expression is null, or
cannot be parsedpublic static DocumentPb.Field checkValid(DocumentPb.Field field)
public static java.util.Locale parseLocale(java.lang.String locale)
Locale parsed from the given locale string.locale - a string representation of a LocaleLocale parsed from the given locale stringjava.lang.IllegalArgumentException - if the locale cannot be parsed