Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unnecessary to externalize jakarta.data.metamodel.impl package #689

Open
njr-11 opened this issue Apr 11, 2024 · 1 comment
Open

unnecessary to externalize jakarta.data.metamodel.impl package #689

njr-11 opened this issue Apr 11, 2024 · 1 comment
Labels
design Improvements or additions to design

Comments

@njr-11
Copy link
Contributor

njr-11 commented Apr 11, 2024

This issue is for after version 1.0.

We shouldn't need to externalize an implementation package, jakarta.data.metamodel.impl, and should easily be able to avoid it by offering a static method to obtain the instance for each attribute type.

Instead of doing this,

import jakarta.data.metamodel.impl.AttributeRecord;
import jakarta.data.metamodel.impl.SortableAttributeRecord;
import jakarta.data.metamodel.impl.TextAttributeRecord;
...
@StaticMetamodel(Person.class) {
    ...
    SortableAttribute<Person> ssn = new SortableAttributeRecord<Person>(SSN);
    TextAttribute<Person> firstName = new TextAttributeRecord<Person>(FIRSTNAME);
    TextAttribute<Person> lastName = new TextAttributeRecord<Person>(LASTNAME);
    Attribute<Person> address = new AttributeRecord<Person>(ADDRESS);
}

we could have something much simpler that doesn't directly access any impl package things,

...
@StaticMetamodel(Person.class) {
    ...
    SortableAttribute<Person> ssn = SortableAttribute.of(SSN);
    TextAttribute<Person> firstName = TextAttribute.of(FIRSTNAME);
    TextAttribute<Person> lastName = TextAttribute.of(LASTNAME);
    Attribute<Person> address = Attribute.of(ADDRESS);
}

The above does not require an impl package to be externalized and appear in the spec or javadoc at all. The jakarta.data.metamodel.impl package and the classes within it could then be deprecated, and in a future version moved from external visibility to hidden.

@njr-11 njr-11 added the design Improvements or additions to design label Apr 11, 2024
@njr-11 njr-11 added this to the Jakarta Data Future milestone Apr 11, 2024
@KyleAure
Copy link
Contributor

If in the future we intend not to externalize jakarta.data.metamodel.impl won't that break users?

exports jakarta.data.metamodel.impl;

If this gets changed to opens or is removed entirely then the record implementations won't be available at compiletime.
Or is the idea we just stop documenting the constructor pattern but still have them available?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design Improvements or additions to design
Projects
None yet
Development

No branches or pull requests

2 participants