All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.peterphi.std.guice.common.serviceprops.ConfigRef Maven / Gradle / Ivy

package com.peterphi.std.guice.common.serviceprops;

import com.google.inject.Provider;
import com.peterphi.std.guice.common.serviceprops.composite.GuiceConfig;
import com.peterphi.std.guice.common.serviceprops.typed.TypedConfigRef;

import java.util.List;

public class ConfigRef implements Provider
{
	private final GuiceConfig configuration;
	private final String name;


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


	public String getName()
	{
		return name;
	}


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


	public String getRaw()
	{
		return configuration.getRaw(name, null);
	}


	public List getList()
	{
		return configuration.getList(name, null);
	}


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


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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy