Event API: Provide typed get methods
- Dominant language
- Java
- Stars
- 14.9k
- Forks
- 3.5k
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 88
Description
Currently we support `Event.getField(...)` which returns an Object.
Most filter and output plugins [citation needed] will need some form of type checking on a field's value before action is taken to avoid class cast or other user-annoying problems.
Rough idea as discussed in today's api meeting, to add the following methods:
* `public Integer Event.getAsInteger(FieldReference)` and for all supported scalar types
* `public List Event.getAsList(FieldReference)` and for all supported scalar types `V`.
The method signature will be roughly as follows, using Integer as an example:
```java
public Integer getAsInteger(FieldReference field) throws FieldMissingException, ConversionFailureException, NullValueException
```
Exception definitions:
* FieldMissingException - the field referenced does not exist in the Event.
* ConversionFailureException - the value could not be converted/coerced/parsed into the requested type (Integer, in this example)
* NullValueException - the value is null. This is a subclass of ConversionFailureException
Contributor guide
Research direction
Start by locating Event.getField and the FieldReference entry point, then review how existing field values and conversion failures are represented. The work is done when typed scalar and list accessors cover the supported types and consistently distinguish missing fields, conversion failures, and null values as described.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100