# Examples

### Getting a reward

Also you can get the reward and parse it as valid type.\
like in this example, where I take a reward called 'exampleTimeReward':

```java
final Optional<Reward> rewardOptional = UltimateReward.getRewardByName("exampleTimeReward");
if (rewardOptional.isPresent()) {
    TimeReward timeReward = (TimeReward) rewardOptional.get();
}
```

### Checking if reward exists

```java
boolean exists = UltimateReward.getRewardByName("rewardName").isPresent();
```

or you can also use the old method which is not allocating anything:

```java
boolean exists = UltimateReward.isReward("rewardName");
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ultimaterewards.athelion.eu/api/examples.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
