cloudevents / cloudevents/sdk-java

A Generic Class for Extensions

Open
#708 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
446
Forks
172
PR merge metrics
No merged PRs in 30d

Description

[info/enhancement proposal] Here's a quick idea to avoid repetitively writing extensions.

The limitations of this concept, to be safe from many perspectives, are that the supported types are basic, and therefore complex elements must be handled outside of the extension itself.

However, there are several advantages, including having ordered keys, working with inheritance, simplifying extension development, and the ability to type both getters and withers. So at the end, we have a patternization of extension creation.

The following link contains the code to implement this concept: https://gist.github.com/stefanofago73/dd03952e9a2c5f2f113ea064320785d0

Could this be helpful? Could it work, or is it not useful due to other use cases or parts of the library?

The basic design is to have a base class and create Extensions by inheritance. The constructor allows you to register keys, while the extension itself allows you to create typed withers. The Java CloudEvents SDK methods are implemented in the base class, including the hashCode and equality methods. The example code is commented and includes an example of an extension (auth context extension).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the linked gist and comparing its proposed base class, registered keys, typed withers, equality, and hashCode behavior with the existing Java CloudEvents SDK extension methods. Check whether the proposal covers the SDK's relevant extension use cases; done would require a clearly scoped design and maintainer agreement before implementation.

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
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.