# UpdateDescriptor

Import: `import com.install4j.api.update.UpdateDescriptor;`

```java
interface UpdateDescriptor extends Serializable
```

Contains information about available updates.

Please see the "Auto-Update" help topic in the documentation for a detailed discussion on updaters.

When building the installers, install4j creates a file `updates.xml` in the media file output directory.
The data in that file is exposed by this class. When you place the `updates.xml` on a web server,
the "Check for update" action can download it and save an instance of this class to an installer variable.
You can also download an update descriptor programmatically in your application by using the
[`UpdateChecker`](UpdateChecker.md) class.

## Methods

| Signature | Returns | Description |
|---|---|---|
| [`getEntries()`](#getentries) | `UpdateDescriptorEntry[]` | Returns all descriptor entries for the different media files of the available version. |
| [`getPossibleUpdateEntry()`](#getpossibleupdateentry) | `UpdateDescriptorEntry` | An entry that has been identified as a match for the current installation and should be used for choosing an update installer. |
| [`getEntryForCurrentMediaFileId()`](#getentryforcurrentmediafileid) | `UpdateDescriptorEntry` | Return an entry that has the same media file ID as the current installation. |
| [`getBaseUrl()`](#getbaseurl) | `String` | Returns the base URL from which update installers will be downloaded. |

### getEntries()

```java
UpdateDescriptorEntry[] getEntries()
```

Returns all descriptor entries for the different media files of the available version.


**Returns:** the descriptor entries

### getPossibleUpdateEntry()

```java
UpdateDescriptorEntry getPossibleUpdateEntry()
```

An entry that has been identified as a match for the current installation and should be used for
choosing an update installer.

This is only non-null if the following conditions are fulfilled:
- there is indeed a newer version available
- the conditions for the maximum and minimum updatable version are satisfied by the current installation
- an entry is available whose target media set ID is equal to the media file ID of the current installation.
Media file IDs can be shown in the media section by invoking "Media->Show IDs" from the
main menu.


**Returns:** the descriptor entry suitable for updating or `null` if no such entry can be found

### getEntryForCurrentMediaFileId()

```java
UpdateDescriptorEntry getEntryForCurrentMediaFileId()
```

Return an entry that has the same media file ID as the current installation.

This is useful if the logic in [`UpdateDescriptor.getPossibleUpdateEntry`](UpdateDescriptor.md#getpossibleupdateentry) is not what you are looking for and
you need to implement your own logic while retaining the match in the media file ID.
No version checks will be performed for the returned entry. If [`UpdateDescriptor.getPossibleUpdateEntry`](UpdateDescriptor.md#getpossibleupdateentry) return
a non-null value, this method will return the same value.


**Returns:** the descriptor entries or `null` if no entry with the same media file ID can be found

**See also:**

- [UpdateDescriptor.getPossibleUpdateEntry](UpdateDescriptor.md#getpossibleupdateentry)

### getBaseUrl()

```java
String getBaseUrl()
```

Returns the base URL from which update installers will be downloaded.

The base URL determines the value of [`UpdateDescriptorEntry.getURL`](UpdateDescriptorEntry.md#geturl) which
returns the URL an update installer will be downloaded from. By default, the base URL is the empty string,
and the update installers will be downloaded from the same directory as the `updates.xml` file.
If `updates.xml` and the update installers are not placed into
the same directory on the web server, you have to change the `baseUrl` attribute in the `updateDescriptor`
element in `updates.xml` to the appropriate URL.


**Returns:** the base URL

