Skip to content
This repository was archived by the owner on Sep 14, 2023. It is now read-only.
This repository was archived by the owner on Sep 14, 2023. It is now read-only.

Inherited fields are not properties #28

Description

@buzden

I'm wondering why inherited fields are not treated as properties.

In particular, in the class co.jirm.mapper.definition.SqlParameterDefinition (at the line 206) the method getDeclaredField() is used to get the field descriptor.

That makes me unable to create objects inherited from some other ones.
For instance, consider the two following classes:

@Entity
public class A {
    protected final int prop;

    @JsonCreator
    public A(final @JsonProperty("prop") int prop) {
        this.prop = prop;
    }

    public int getProp() {
        return prop;
    }
}
@Entity
public class B extends A {
    protected final int another;

    @JsonCreator
    public B(
            final @JsonProperty("prop") int prop,
            final @JsonProperty("another") int another) {
        super(prop);

        this.another = another;
    }

    public int getProp() {
        return prop;
    }
}

When storing an instance of B I get the exception that prop is not a field of B. That's weird.

May be the library can't mange inheritance at all, but I hadn't found that information in the description.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions