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 Util

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

    public final class Util

extends java.lang.Object

A utility class that does various checks on search and indexing parameters.

Method Summary
`static
`<T> T`
` | `defaultIfNull(T value, T defaultValue)` A helper method for overriding null values with a default value.
`static boolean` | `equalObjects(java.lang.Object a, java.lang.Object b)` A helper method for testing two objects are equal.
`static java.lang.String` | `fieldToString(java.lang.String name, java.lang.Object value)` Returns a string that allows a field value pair to be added to a debug string.
`static boolean` | `isNullOrEmpty(java.lang.String string)`
`static
`<T> java.lang.String`
` | `iterableFieldToString(java.lang.String fieldName, java.lang.Iterable<T> objects)` Returns a string which can be used to append an iterable field to a debug string.
`static
`<T> java.lang.String`
` | `iterableToString(java.lang.Iterable<T> objects, int limit)` Returns a string representation of the iterable objects.

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

Method Detail

### isNullOrEmpty

    public static boolean isNullOrEmpty(java.lang.String string)

  Returns:
    whether or not the string is null or empty

### equalObjects

    public static boolean equalObjects(java.lang.Object a,
                                       java.lang.Object b)

  A helper method for testing two objects are equal.

  Returns:
    whether the two objects a and b are equal

### defaultIfNull

    public static <T> T defaultIfNull(T value,
                                      T defaultValue)

  A helper method for overriding null values with a default value.

  Parameters:
    `value` - the value of some field
    `defaultValue` - the default value for the field
  Returns:
    value if it is not null, otherwise the defaultValue

### iterableToString

    public static <T> java.lang.String iterableToString(java.lang.Iterable<T> objects,
                                                        int limit)

  Returns a string representation of the iterable objects. This is used in debugging. The limit parameter is used to control how many elements of the iterable are used to build the final string. Use 0 or negative values, to include all.

  Parameters:
    `objects` - an iterable of objects to be turned into a string
    `limit` - the maximum number of objects from iterable to be used to build a string

### iterableFieldToString

    public static <T> java.lang.String iterableFieldToString(java.lang.String fieldName,
                                                             java.lang.Iterable<T> objects)

  Returns a string which can be used to append an iterable field to a debug string.

### fieldToString

    public static java.lang.String fieldToString(java.lang.String name,
                                                 java.lang.Object value)

  Returns a string that allows a field value pair to be added to a debug string.

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