Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.google.appengine.api.search
Class Field

    java.lang.Object
      com.google.appengine.api.search.Field

All Implemented Interfaces:
  java.io.Serializable

    public final class Field

extends java.lang.Object
implements java.io.Serializable

Represents a field of a `Document`, which is a name, an optional locale, and at most one value: text, HTML, atom or date. Field name lengths are between 1 and FieldChecker#MAXIMUM_NAME_LENGTH characters, and text and HTML values are limited to FieldChecker#MAXIMUM_TEXT_LENGTH. Atoms as limited to FieldChecker#MAXIMUM_ATOM_LENGTH characters, and dates must not have a time component.

See Also:
  Serialized Form

Nested Class Summary
`static class` | `Field.Builder` A field builder.
`static class` | `Field.FieldType` The type of the field value.

Method Summary
`static java.util.Date` | `date(java.util.Date date)` Returns a date which has been truncated to a day of month.
`boolean` | `equals(java.lang.Object object)`
`java.lang.String` | `getAtom()`
`java.util.Date` | `getDate()`
`java.lang.String` | `getHTML()`
`java.util.Locale` | `getLocale()`
`java.lang.String` | `getName()`
`java.lang.Double` | `getNumber()`
`java.lang.String` | `getText()`
`Field.FieldType` | `getType()`
`int` | `hashCode()`
`static Field.Builder` | `newBuilder()` Creates a field builder.
`java.lang.String` | `toString()`
`static java.util.Date` | `truncate(java.util.Date date, int field)` Truncates given date leaving date elements lesser than the specified field set to 0.

Methods inherited from class java.lang.Object
`getClass, notify, notifyAll, wait, wait, wait`

Method Detail

### getName

    public java.lang.String getName()

  Returns:
    the name of the field

### getType

    public Field.FieldType getType()

  Returns:
    the type of value of the field. Can be null

### getText

    public java.lang.String getText()

  Returns:
    the text value of the field. Can be null

### getHTML

    public java.lang.String getHTML()

  Returns:
    the HTML value of the field. Can be null

### getAtom

    public java.lang.String getAtom()

  Returns:
    the atomic value of the field. Can be null

### getDate

    public java.util.Date getDate()

  Returns:
    the date value of the field. Can be null

### getNumber

    public java.lang.Double getNumber()

  Returns:
    the numeric value of the field. Can be null

### getLocale

    public java.util.Locale getLocale()

  Returns:
    the locale the field value is written in. Can be null. If none is given the locale of the document will be used

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `java.lang.Object`

### equals

    public boolean equals(java.lang.Object object)

  Overrides:
    `equals` in class `java.lang.Object`

### newBuilder

    public static Field.Builder newBuilder()

  Creates a field builder.

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

### date

    public static java.util.Date date(java.util.Date date)

  Returns a date which has been truncated to a day of month.

  Parameters:
    `date` - the date to be truncated
  Returns:
    the date with fields less significant than `Calendar.DAY_OF_MONTH`

### truncate

    public static java.util.Date truncate(java.util.Date date,
                                          int field)

  Truncates given date leaving date elements lesser than the specified field set to 0. For example, if you wish to remove time component from the date use the following:

         Date d = ...
         Date yearMonthDay = Field.truncate(d, Calendar.DAY_OF_MONTH);

  Parameters:
    `date` - the date to be truncated
    `field` - the least significant field to be left untouched
  Returns:
    the date with fields less significant than field set to 0
  Throws:
    `java.lang.IllegalArgumentException` - if field is not a valid datetime field.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD