Skip to content

[Feature request] Recursive configs? #19

Open
@divyekapoor

Description

@divyekapoor

Brian - thank you for a wonderful config library. We are finding it of good use.

One snag we hit recently is that the library doesn't support recursive configurations:
(simplified example)

public interface KVConfig {
   @Config("dataset_name")
   public String datasetName();

   @Config("dataset_path")
   public String datasetPath();
}

public interface CommonConfigs {
   @Config("pin_impression")
   KVConfig getPinImpressionKVConfigs();

  @Config("pin_repin")
  KVConfig getPinRepinKVConfigs();
}

The above doesn't work because the type coercion does not recursively try to parse the KVConfig type (it tries to cast to it).
It might be that this is "user error" and that this is supported - a colleague of mine and I couldn't get it working if so and we had to use parameterized configs instead as a workaround (pull request to update the Readme is here -- #18)

Could you:

  1. Confirm if this is a supported or unsupported?
  2. If unsupported, is this "easy" to do? (eg. just reinstantiate (internally) a ConfigurationObjectBuilder and bind?) or are there other complexities?
  3. If easy to do, could you suggest next steps? (if this is a super easy one-liner, would you be open to implementing the request?)

Best,
Divye

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