com.tngtech.propertyloader.impl.DefaultPropertySuffixContainer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of property-loader Show documentation
Show all versions of property-loader Show documentation
The property loader is a java library for managing property configurations.
package com.tngtech.propertyloader.impl;
import com.tngtech.propertyloader.impl.helpers.HostsHelper;
import com.tngtech.propertyloader.impl.interfaces.PropertySuffixContainer;
import java.util.ArrayList;
import java.util.List;
public class DefaultPropertySuffixContainer implements PropertySuffixContainer {
private final HostsHelper hostsHelper;
private final List suffixes = new ArrayList<>();
public DefaultPropertySuffixContainer(HostsHelper hostsHelper) {
this.hostsHelper = hostsHelper;
}
public DefaultPropertySuffixContainer addUserName() {
this.suffixes.add(System.getProperty("user.name"));
return this;
}
public DefaultPropertySuffixContainer addLocalHostNames() {
this.suffixes.addAll(hostsHelper.getLocalHostNames());
return this;
}
public DefaultPropertySuffixContainer addString(String suffix) {
this.suffixes.add(suffix);
return this;
}
public DefaultPropertySuffixContainer addSuffixList(List suffixes) {
this.suffixes.addAll(suffixes);
return this;
}
public List getSuffixes() {
return suffixes;
}
public DefaultPropertySuffixContainer addDefaultSuffixes() {
addUserName();
addLocalHostNames();
addString("override");
return this;
}
public DefaultPropertySuffixContainer clear() {
suffixes.clear();
return this;
}
}