<commit_before>package com.peterphi.std.guice.common.serviceprops;

import com.google.inject.Provider;
import com.peterphi.std.guice.common.serviceprops.typed.TypedConfigRef;
import org.apache.commons.configuration.Configuration;

public class ConfigRef implements Provider<String>
{
	private final Configuration configuration;
	private final String name;


	public ConfigRef(final Configuration configuration, final String name)
	{
		this.configuration = configuration;
		this.name = name;
	}


	@Override
	public String get()
	{
		return configuration.getString(name);
	}


	public <T> T get(Class<T> clazz)
	{
		return as(clazz).get();
	}


	public <T> TypedConfigRef<T> as(final Class<T> clazz)
	{
		return new TypedConfigRef<>(this, clazz);
	}
}
<commit_msg>Add methods to retrieve a string[] as well as the underlying object if needed<commit_after>package com.peterphi.std.guice.common.serviceprops;

import com.google.inject.Provider;
import com.peterphi.std.guice.common.serviceprops.typed.TypedConfigRef;
import org.apache.commons.configuration.Configuration;

import java.util.List;

public class ConfigRef implements Provider<String>
{
	private final Configuration configuration;
	private final String name;


	public ConfigRef(final Configuration configuration, final String name)
	{
		this.configuration = configuration;
		this.name = name;
	}


	@Override
	public String get()
	{
		return configuration.getString(name);
	}


	public String[] getStringArray()
	{
		return configuration.getStringArray(name);
	}


	public List<Object> getList()
	{
		return configuration.getList(name);
	}


	public Object getObject()
	{
		return configuration.getProperty(name);
	}


	public <T> T get(Class<T> clazz)
	{
		return as(clazz).get();
	}


	public <T> TypedConfigRef<T> as(final Class<T> clazz)
	{
		return new TypedConfigRef<>(this, clazz);
	}
}

{'fraction_non_alphanumeric': 0.10619946091644204, 'fraction_numerical': 0.0, 'mean_word_length': 4.910828025477707, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1698558', 'n_tokens_mistral': 612, 'n_tokens_neox': 579, 'n_words': 140}