|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.google.appengine.api.search.checkers.FieldChecker
public final class FieldChecker
Provides checks for Field names, language code, and values: text, HTML, atom or date.
Field Summary | |
---|---|
static java.lang.String |
FIELD_NAME_PATTERN
The pattern each document field name should match. |
static float |
MAX_NUMBER_VALUE
The maximum value that can be stored in a number field (1048576.0f). |
static int |
MAXIMUM_ATOM_LENGTH
The maximum length of an atom (500). |
static int |
MAXIMUM_NAME_LENGTH
The maximum length of a field name (500). |
static int |
MAXIMUM_TEXT_LENGTH
The maximum length of a text or HTML (1048576). |
static float |
MIN_NUMBER_VALUE
The minimum value that can be stored in a number field (-1048576.0f). |
Constructor Summary | |
---|---|
FieldChecker()
|
Method Summary | |
---|---|
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 specified in ISO860 format. |
static java.lang.String |
checkExpression(java.lang.String expression)
Checks whether 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 |
checkText(java.lang.String text)
Checks whether a text is valid. |
static DocumentPb.Field |
checkValid(DocumentPb.Field field)
|
static java.util.Locale |
parseLocale(java.lang.String locale)
Returns a Locale parsed from the given locale string. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int MAXIMUM_NAME_LENGTH
public static final int MAXIMUM_TEXT_LENGTH
public static final int MAXIMUM_ATOM_LENGTH
public static final float MAX_NUMBER_VALUE
public static final float MIN_NUMBER_VALUE
public static final java.lang.String FIELD_NAME_PATTERN
Constructor Detail |
---|
public FieldChecker()
Method Detail |
---|
public static java.lang.String checkFieldName(java.lang.String name)
MAXIMUM_NAME_LENGTH
and it should match
FIELD_NAME_PATTERN
.
name
- the field name to check
java.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 checkFieldName(java.lang.String name, java.lang.String fieldName)
MAXIMUM_NAME_LENGTH
and it should match
FIELD_NAME_PATTERN
.
name
- the field name to checkfieldName
- the name of the Java field name of the class where
name is checked
java.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 check
java.lang.IllegalArgumentException
- if text is too longpublic static java.lang.String checkHTML(java.lang.String html)
html
- the html to check
java.lang.IllegalArgumentException
- if html is too longpublic static java.lang.String checkAtom(java.lang.String atom)
atom
- the atom to check
java.lang.IllegalArgumentException
- if atom is too longpublic static java.lang.Double checkNumber(java.lang.Double value)
MIN_NUMBER_VALUE
and MAX_NUMBER_VALUE
.
value
- the value to check
java.lang.IllegalArgumentException
- if number is too longpublic static java.util.Date checkDate(java.util.Date date) throws java.lang.IllegalArgumentException
date
- the date to check
java.lang.IllegalArgumentException
- if date has a time componentpublic static java.lang.String checkExpression(java.lang.String expression)
expression
- the expression to check
java.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 Locale
Locale
parsed from the given locale string
java.lang.IllegalArgumentException
- if the locale cannot be parsed
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |