# 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), [FlightNumberEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/FlightNumberEntity), [IbanEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/IbanEntity), [IsbnEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/IsbnEntity), [MoneyEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/MoneyEntity), [PaymentCardEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/PaymentCardEntity), [TrackingNumberEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/TrackingNumberEntity) |---|---| | [DateTimeEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/DateTimeEntity) | A date-time entity extracted from a piece of text. | | [FlightNumberEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/FlightNumberEntity) | A flight number entity extracted from a piece of text. | | [IbanEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/IbanEntity) | 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) | 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) | A money entity extracted from a piece of text. | | [PaymentCardEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/PaymentCardEntity) | A payment card entity extracted from a piece of text. | | [TrackingNumberEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/TrackingNumberEntity) | 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) || 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#TYPE_ADDRESS) | Identifies a physical address. |
| int | [TYPE_DATE_TIME](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/Entity#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#TYPE_EMAIL) | Identifies an e-mail address. |
| int | [TYPE_FLIGHT_NUMBER](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/Entity#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#TYPE_IBAN) | Identifies an International Bank Account Number (IBAN). |
| int | [TYPE_ISBN](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/Entity#TYPE_ISBN) | Identifies an International Standard Book Number (ISBN). |
| int | [TYPE_MONEY](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/Entity#TYPE_MONEY) | Identifies an amount of money. |
| int | [TYPE_PAYMENT_CARD](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/Entity#TYPE_PAYMENT_CARD) | Identifies a payment card. |
| int | [TYPE_PHONE](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/Entity#TYPE_PHONE) | Identifies a phone number. |
| int | [TYPE_TRACKING_NUMBER](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/Entity#TYPE_TRACKING_NUMBER) | Identifies a shipment tracking number. |
| int | [TYPE_URL](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/Entity#TYPE_URL) | Identifies a URL. |

### Public Method Summary

|---|---|
| [DateTimeEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/DateTimeEntity) | [asDateTimeEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/Entity#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) | [asFlightNumberEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/Entity#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) | [asIbanEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/Entity#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) | [asIsbnEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/Entity#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) | [asMoneyEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/Entity#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) | [asPaymentCardEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/Entity#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) | [asTrackingNumberEntity](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/Entity#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#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#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)
**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)
**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)
**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)
**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)
**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)
**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)
**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. `https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/Entity#TYPE_EMAIL`)
of this entity.

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