Skip to content
New issue

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

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

Already on GitHub? # to your account

Support logical fields(method @Column) #1835

Open
DreamStar92 opened this issue Jul 12, 2024 · 2 comments
Open

Support logical fields(method @Column) #1835

DreamStar92 opened this issue Jul 12, 2024 · 2 comments
Labels
status: pending-design-work Needs design work before any code can be developed type: enhancement A general enhancement

Comments

@DreamStar92
Copy link

Supporting methods as write-only fields, the current implementation causes confusion when using properties because the field value is a placeholder.

Or are there other correct ways to implement logical fields that I don’t know? Please let me know.

expect

    public class Rectangle {

        private int h;
        private int w;

        @Column
        public int area() {
            return h * w;
        }

    }

current

    public class Rectangle {

        private int h;
        private int w;
        @AccessType(AccessType.Type.PROPERTY)
        private int area;
        
        public int getArea() {
            return h * w;
        }

    }
@schauder
Copy link
Contributor

The write only property would at the very least be constructed as a normal getter:

public int area() {
    return h * w;
}

That said, it doesn't work either. :-/

@schauder schauder added type: enhancement A general enhancement status: pending-design-work Needs design work before any code can be developed and removed status: waiting-for-triage An issue we've not yet triaged labels Jul 16, 2024
@schauder schauder removed their assignment Jul 16, 2024
@DreamStar92
Copy link
Author

DreamStar92 commented Jul 16, 2024

This should work fine with just the annotations, and should not require special forms of method names.

Currently, even if it is a normal getter, it will not take effect if there is no field.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
status: pending-design-work Needs design work before any code can be developed type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants