owner icon indicating copy to clipboard operation
owner copied to clipboard

How to get a single element list of strings containing `\n` ?

Open alexander-poulikakos opened this issue 4 years ago • 0 comments

How to get a single element list of Strings that contains \n from a configuration?

Example code:

	public static void main(String[] args) {
		WithSingleElementList conf = ConfigFactory.create(WithSingleElementList.class);
		List<String> list = conf.getList();
		System.out.println(conf.getList().size()); // Expected to be 1 but is 0
		System.out.println(list);
	}
	
	public static interface WithSingleElementList extends Config {
		@DefaultValue("\n")
		List<String> getList();
	}

Are there any workarounds that would make above code return a one element List, instead of an empty list?

alexander-poulikakos avatar Sep 14 '20 11:09 alexander-poulikakos