Replies: 2 comments 4 replies
-
A quick question: since this specification will be at the earliest going into Jakarta EE 11, which is quite a ways off, must we target Java 11? I don't want to have the whole discussion here, just looking for a reference somewhere that says "yes, it's Java 11 for the next revision" or something. |
Beta Was this translation helpful? Give feedback.
2 replies
-
Related question: may a "config object" be of any type? Or must it extend or implement a special supertype? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The current discussion aims to detail and document the decision-making of the Config Object design.
State of the Art
Some of the most popular frameworks already provide such capability in one way or another:
The observed trends were the following:
class
based approach.prefix
ornamespace
to define the starting configuration path(with a way to override it)
Collections
,Maps
)Class vs Interface
How should a complex object type be represented as a
class
or aninterface
? Or maybe both?Using a
class
has some downsides:IllegalAccess
errors ifprivate
fields are supported (without setters)Using an
interface
removes most of these downsides, adding some of their own:Some Jakarta EE specifications (JPA, JSONB) use POJOs to bind data. While similar, it is not intended for the
end-user to modify the configuration representation directly. The Config instance will handle any change
(even with mutability support), so a POJO is not required to support the configuration needs fully.
In this case, an
Interface
to represent configuration complex types seems to be a better option.Records
The specification targets Java 11 language level. For this reason, Java 14 Records do not belong to the specification.
Implementations are free to support Java Records at their consideration.
Beta Was this translation helpful? Give feedback.
All reactions