Skip to content

Profile.as(Class, String) ignores the prefix when propertyFirstUpper is on #18

Open

Description

@szkiba

Profile.as(Class, String) should look for the section named by the prefix followed by the property name. With Config.setPropertyFirstUpper(true) the prefix is dropped.

public interface Dwarf { String getName(); }
public interface Root { Dwarf getDwarf(); }

Ini ini = new Ini();
ini.getConfig().setPropertyFirstUpper(true);
ini.add("pDwarf").put("Name", "prefix and upper");
ini.add("Dwarf").put("Name", "upper only");

ini.as(Root.class, "p").getDwarf().getName(); // "upper only"

In BasicProfile.BeanInvocationHandler.transform, the first-upper branch builds its result from the property name alone and overwrites the text that already has the prefix. Without the flag the prefix works as documented.

BasicOptionMap handles the same two options by keeping the prefix and capitalizing the property name, so the expected result here is prefix and upper, from the section pDwarf. The Javadoc of Profile.as(Class, String) describes the current behavior.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions