# Entity

public class **Entity** extends [Object](https://developer.android.com/reference/java/lang/Object.html)  
Known Direct Subclasses [DateTimeEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/DateTimeEntity.md.txt), [FlightNumberEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/FlightNumberEntity.md.txt), [IbanEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/IbanEntity.md.txt), [IsbnEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/IsbnEntity.md.txt), [MoneyEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/MoneyEntity.md.txt), [PaymentCardEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/PaymentCardEntity.md.txt), [TrackingNumberEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/TrackingNumberEntity.md.txt) [DateTimeEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/DateTimeEntity.md.txt) A date-time entity extracted from a piece of text. [FlightNumberEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/FlightNumberEntity.md.txt) A flight number entity extracted from a piece of text. [IbanEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/IbanEntity.md.txt) An IBAN (International Bank Account Number) entity extracted from a piece of text. [IsbnEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/IsbnEntity.md.txt) An ISBN (International Standard Book Number) entity extracted from a piece of text. [MoneyEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/MoneyEntity.md.txt) A money entity extracted from a piece of text. [PaymentCardEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/PaymentCardEntity.md.txt) A payment card entity extracted from a piece of text. [TrackingNumberEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/TrackingNumberEntity.md.txt) A parcel tracking number entity extracted from a piece of text. An entity extracted from a piece of text.

### Nested Class Summary

|---|---|---|---|
| @interface | [Entity.Type](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/Entity.Type.md.txt) || The type of an extracted entity(e.g. |

### Constant Summary

|---|---|---|
| int | [TYPE_ADDRESS](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/Entity.md.txt#TYPE_ADDRESS) | Identifies a physical address. |
| int | [TYPE_DATE_TIME](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/Entity.md.txt#TYPE_DATE_TIME) | Identifies a time reference that includes a specific time. |
| int | [TYPE_EMAIL](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/Entity.md.txt#TYPE_EMAIL) | Identifies an e-mail address. |
| int | [TYPE_FLIGHT_NUMBER](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/Entity.md.txt#TYPE_FLIGHT_NUMBER) | Identifies a flight number in IATA format. |
| int | [TYPE_IBAN](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/Entity.md.txt#TYPE_IBAN) | Identifies an International Bank Account Number (IBAN). |
| int | [TYPE_ISBN](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/Entity.md.txt#TYPE_ISBN) | Identifies an International Standard Book Number (ISBN). |
| int | [TYPE_MONEY](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/Entity.md.txt#TYPE_MONEY) | Identifies an amount of money. |
| int | [TYPE_PAYMENT_CARD](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/Entity.md.txt#TYPE_PAYMENT_CARD) | Identifies a payment card. |
| int | [TYPE_PHONE](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/Entity.md.txt#TYPE_PHONE) | Identifies a phone number. |
| int | [TYPE_TRACKING_NUMBER](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/Entity.md.txt#TYPE_TRACKING_NUMBER) | Identifies a shipment tracking number. |
| int | [TYPE_URL](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/Entity.md.txt#TYPE_URL) | Identifies a URL. |

### Public Method Summary

|---|---|
| [DateTimeEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/DateTimeEntity.md.txt) | [asDateTimeEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/Entity.md.txt#asDateTimeEntity())() Convenience method that returns the current entity cast to a DateTimeEntity. |
| [FlightNumberEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/FlightNumberEntity.md.txt) | [asFlightNumberEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/Entity.md.txt#asFlightNumberEntity())() Convenience method that returns the current entity cast to a FlightNumberEntity. |
| [IbanEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/IbanEntity.md.txt) | [asIbanEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/Entity.md.txt#asIbanEntity())() Convenience method that returns the current entity cast to a IbanEntity. |
| [IsbnEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/IsbnEntity.md.txt) | [asIsbnEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/Entity.md.txt#asIsbnEntity())() Convenience method that returns the current entity cast to a IsbnEntity. |
| [MoneyEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/MoneyEntity.md.txt) | [asMoneyEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/Entity.md.txt#asMoneyEntity())() Convenience method that returns the current entity cast to a MoneyEntity. |
| [PaymentCardEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/PaymentCardEntity.md.txt) | [asPaymentCardEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/Entity.md.txt#asPaymentCardEntity())() Convenience method that returns the current entity cast to a PaymentCardEntity. |
| [TrackingNumberEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/TrackingNumberEntity.md.txt) | [asTrackingNumberEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/Entity.md.txt#asTrackingNumberEntity())() Convenience method that returns the current entity cast to a TrackingNumberEntity. |
| int | [getType](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/Entity.md.txt#getType())() Returns the type(e.g. |
| [String](https://developer.android.com/reference/java/lang/String.html) | [toString](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/Entity.md.txt#toString())() |

### Inherited Method Summary

From class java.lang.Object

|---|---|
| [Object](https://developer.android.com/reference/java/lang/Object.html) | clone() |
| boolean | equals([Object](https://developer.android.com/reference/java/lang/Object.html) arg0) |
| void | finalize() |
| final [Class](https://developer.android.com/reference/java/lang/Class.html)\<?\> | getClass() |
| int | hashCode() |
| final void | notify() |
| final void | notifyAll() |
| [String](https://developer.android.com/reference/java/lang/String.html) | toString() |
| final void | wait(long arg0, int arg1) |
| final void | wait(long arg0) |
| final void | wait() |

## Constants

#### public static final int
**TYPE_ADDRESS**

Identifies a physical address.
Constant Value: 1

#### public static final int
**TYPE_DATE_TIME**

Identifies a time reference that includes a specific time. May be absolute such as
"01/01/2000 5:30pm" or relative like "tomorrow".
Constant Value: 2

#### public static final int
**TYPE_EMAIL**

Identifies an e-mail address.
Constant Value: 3

#### public static final int
**TYPE_FLIGHT_NUMBER**

Identifies a flight number in IATA format.
Constant Value: 4

#### public static final int
**TYPE_IBAN**

Identifies an International Bank Account Number (IBAN).
Constant Value: 5

#### public static final int
**TYPE_ISBN**

Identifies an International Standard Book Number (ISBN).
Constant Value: 6

#### public static final int
**TYPE_MONEY**

Identifies an amount of money.
Constant Value: 11

#### public static final int
**TYPE_PAYMENT_CARD**

Identifies a payment card.
Constant Value: 7

#### public static final int
**TYPE_PHONE**

Identifies a phone number.
Constant Value: 8

#### public static final int
**TYPE_TRACKING_NUMBER**

Identifies a shipment tracking number.
Constant Value: 9

#### public static final int
**TYPE_URL**

Identifies a URL.
Constant Value: 10

## Public Methods

#### public [DateTimeEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/DateTimeEntity.md.txt)
**asDateTimeEntity** ()

Convenience method that returns the current entity cast to a DateTimeEntity. Returns
`null` if the current entity is not of type DATE_TIME.

#### public [FlightNumberEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/FlightNumberEntity.md.txt)
**asFlightNumberEntity** ()

Convenience method that returns the current entity cast to a FlightNumberEntity.
Returns null if the current entity is not of type FLIGHT_NUMBER.

#### public [IbanEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/IbanEntity.md.txt)
**asIbanEntity** ()

Convenience method that returns the current entity cast to a IbanEntity. Returns
`null` if the current entity is not of type IBAN.

#### public [IsbnEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/IsbnEntity.md.txt)
**asIsbnEntity** ()

Convenience method that returns the current entity cast to a IsbnEntity. Returns
`null` if the current entity is not of type ISBN.

#### public [MoneyEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/MoneyEntity.md.txt)
**asMoneyEntity** ()

Convenience method that returns the current entity cast to a MoneyEntity. Returns
`null` if the current entity is not of type MONEY.

#### public [PaymentCardEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/PaymentCardEntity.md.txt)
**asPaymentCardEntity** ()

Convenience method that returns the current entity cast to a PaymentCardEntity.
Returns `null` if the current entity is not of type PAYMENT_CARD.

#### public [TrackingNumberEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/TrackingNumberEntity.md.txt)
**asTrackingNumberEntity** ()

Convenience method that returns the current entity cast to a TrackingNumberEntity.
Returns null if the current entity is not of type TRACKING_NUMBER.

#### public int **getType** ()

Returns the type(e.g. `TYPE_EMAIL`)
of this entity.

#### public [String](https://developer.android.com/reference/java/lang/String.html) **toString** ()