Back to Fresco

TriState

docs/javadoc/reference/com/facebook/common/util/TriState.html

3.6.014.9 KB
Original Source

Fresco

|

|

Packages | Classes

Classes

Enums

Exceptions

Packages | Classes

Summary: Enums | Methods | Inherited Methods | [Expand All]

public final enum

TriState

extends Enum<E extends Enum<E>>

| java.lang.Object | | ↳ | java.lang.Enum<E extends java.lang.Enum<E>> | | | ↳ | com.facebook.common.util.TriState |

Class Overview

Generic tri-state enum for boolean values that can also be unset.

Summary

Enum Values
TriState
TriState
TriState
Public Methods
boolean
Returns the boolean value that corresponds to this TriState, if appropriate.
boolean
Returns the boolean value that corresponds to this TriState, if appropriate.
Boolean
Returns the Boolean value that corresponds to this TriState, if appropriate.
static TriState
int
boolean
static TriState
static TriState
Returns the value of the TriState enum that corresponds to the specified boolean.
static TriState
final static TriState[]

| [Expand] Inherited Methods | | --- | | From class java.lang.Enum

| final Object | clone() | | final int | compareTo(E arg0) | | int | compareTo(Object arg0) | | final boolean | equals(Object arg0) | | final void | finalize() | | final Class<E> | getDeclaringClass() | | final int | hashCode() | | final String | name() | | final int | ordinal() | | String | toString() | | static <T extends Enum<T>> T | valueOf(Class<T> arg0, String arg1) |

| | From class java.lang.Object

| Object | clone() | | boolean | equals(Object arg0) | | void | finalize() | | final Class<?> | getClass() | | int | hashCode() | | final void | notify() | | final void | notifyAll() | | String | toString() | | final void | wait(long arg0, int arg1) | | final void | wait(long arg0) | | final void | wait() |

| | From interface java.lang.Comparable

| abstract int | compareTo(T arg0) |

|

Enum Values

public static final TriState NO

public static final TriState UNSET

public static final TriState YES

Public Methods

public boolean asBoolean(boolean defaultValue)

Returns the boolean value that corresponds to this TriState, if appropriate.

Parameters

| defaultValue | default value to use if not set |

Returns
  • true if this is YES or false if this is NO or defaultValue if this is UNSET.

public boolean asBoolean()

Returns the boolean value that corresponds to this TriState, if appropriate.

Returns
  • true if this is YES or false if this is NO
Throws

| IllegalStateException | if this is UNSET. |

public Boolean asBooleanObject()

Returns the Boolean value that corresponds to this TriState, if appropriate.

Returns
  • TRUE if this is YES or FALSE if this is NO or null if this is UNSET.

public static TriState fromDbValue(int value)

public int getDbValue()

public boolean isSet()

Returns
  • whether this value is set; that is, whether it is YES or NO.

public static TriState valueOf(String name)

public static TriState valueOf(boolean bool)

Returns the value of the TriState enum that corresponds to the specified boolean.

This method deliberately declares boolean as its param type rather than Boolean because:

  1. Declaring Boolean would likely result in a bunch of unnecessary autoboxing.
  2. Anyone who finds himself using a Boolean instead of a boolean for its nullability should replace the Boolean with a TriState, anyway.

public static TriState valueOf(Boolean bool)

public static final TriState[] values()

+Generated by Doclava. +