com.anrisoftware.resources.GetBundleWithControl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of resources-getbundle Show documentation
Show all versions of resources-getbundle Show documentation
Offers an object oriented way to create ResourceBundle depending on the given parameter.
/*
* Copyright 2012-2016 Erwin Müller
*
* This file is part of resources-getbundle.
*
* resources-getbundle is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* resources-getbundle is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with resources-getbundle. If not, see .
*/
package com.anrisoftware.resources;
import static java.util.ResourceBundle.getBundle;
import java.util.Locale;
import java.util.ResourceBundle;
/**
* Returns the resource bundle with the specified base name and control.
*
* @author Erwin Mueller, [email protected]
* @since 1.0
*/
public class GetBundleWithControl extends GetBundle {
private final ResourceBundle.Control control;
/**
* Sets the resource bundle the base name and class loader.
*
* @param baseName
* the bundle base name {@link String}.
*
* @param control
* the bundle {@link ResourceBundle.Control}.
*/
public GetBundleWithControl(String baseName, ResourceBundle.Control control) {
super(baseName);
this.control = control;
}
@Override
public ResourceBundle bundleFor(Locale locale) {
return getBundle(getBaseName(), locale, control);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy