
org.omnaest.i18nbinder.test.i18nfacade.i18n.AdminTest Maven / Gradle / Ivy
The newest version!
package org.omnaest.i18nbinder.test.i18nfacade.i18n;
import java.util.Locale;
import java.util.MissingResourceException;
import javax.annotation.Generated;
import java.util.Map;
import org.omnaest.i18nbinder.test.I18nFacade;
import org.omnaest.i18nbinder.test.I18nFacade.Translator;
/**
* This is an automatically with i18nBinder generated facade class.
* To modify please adapt the underlying property files.
* If the facade class is instantiated with a given {@link Locale} using {@link #AdminTest(Locale)} all non static methods will use this predefined {@link Locale} when invoked.
* The facade methods will silently ignore all {@link MissingResourceException}s by default. To alter this behavior see {@link #AdminTest(Locale, boolean)}
* Resource base: i18n.adminTest
*
* Examples:
*
*
*
* key
* examples
*
*
*
*
* my.property.key1
* _de_DE=wert1
*
*
* _en_US=value1
*
*
* my.property.key2
* _de_DE=wert2
*
*
* _en_US=value2
*
*
*
* @see #translator()
* @see #translator(Locale)
*/
@Generated(value = "http://code.google.com/p/i18n-binder/", date = "2012-06-24T18:35:00+02:00")
public class AdminTest {
public final static String baseName = "i18n.adminTest";
private final Locale locale;
private final boolean silentlyIgnoreMissingResourceException;
/**
* This {@link AdminTest} constructor will create a new instance which silently ignores any {@link MissingResourceException}
* @see AdminTest
* @param locale
*/
public AdminTest( Locale locale )
{
this(locale,true);
}
/**
* @see AdminTest
* @param locale
* @param silentlyIgnoreMissingResourceException
*/
public AdminTest( Locale locale, boolean silentlyIgnoreMissingResourceException )
{
super();
this.locale = locale;
this.silentlyIgnoreMissingResourceException = silentlyIgnoreMissingResourceException;
}
/**
* Similar to {@link #getMyPropertyKey1()} for the given {@link Locale}.
* @see AdminTest
* @see #getMyPropertyKey1()
* @param locale
*/
protected String getMyPropertyKey1(Locale locale)
{
try
{
final String key = "my.property.key1";
return I18nFacade.Resource.resourceBasedTranslator.translate( baseName, key, locale );
}
catch ( MissingResourceException e )
{
if (!this.silentlyIgnoreMissingResourceException)
{
throw e;
}
return null;
}
}
/**
* Returns the value of the property key my.property.key1 for the predefined {@link Locale}.
*
*
* Examples:
*
* - _de_DE=wert1
* - _en_US=value1
*
* @see AdminTest
*/
public String getMyPropertyKey1()
{
return getMyPropertyKey1( this.locale );
}
/**
* Similar to {@link #getMyPropertyKey2()} for the given {@link Locale}.
* @see AdminTest
* @see #getMyPropertyKey2()
* @param locale
*/
protected String getMyPropertyKey2(Locale locale)
{
try
{
final String key = "my.property.key2";
return I18nFacade.Resource.resourceBasedTranslator.translate( baseName, key, locale );
}
catch ( MissingResourceException e )
{
if (!this.silentlyIgnoreMissingResourceException)
{
throw e;
}
return null;
}
}
/**
* Returns the value of the property key my.property.key2 for the predefined {@link Locale}.
*
*
* Examples:
*
* - _de_DE=wert2
* - _en_US=value2
*
* @see AdminTest
*/
public String getMyPropertyKey2()
{
return getMyPropertyKey2( this.locale );
}
/**
* Returns a new instance of {@link AdminTest} which uses the given setting for the exception handling
* @see AdminTest
* @param silentlyIgnoreMissingResourceException
*/
public AdminTest doSilentlyIgnoreMissingResourceException( boolean silentlyIgnoreMissingResourceException )
{
return new AdminTest( this.locale, silentlyIgnoreMissingResourceException );
}
/**
* Returns a new instance of {@link AdminTest} which uses the given {@link Locale}
* @see AdminTest
* @param locale
*/
public AdminTest forLocale( Locale locale )
{
return new AdminTest( locale, this.silentlyIgnoreMissingResourceException );
}
/**
* Returns a new {@link Translator} instance using the given {@link Locale} and based on the {@value #baseName} i18n base
* @see AdminTest
* @see #translator()
* @see #translator(Locale)
* @return {@link Translator} */
public static Translator translator(Locale locale, boolean silentlyIgnoreMissingResourceException)
{
return new Translator( baseName, locale, silentlyIgnoreMissingResourceException );
}
/**
* Returns a new {@link Translator} instance using the given {@link Locale} and based on the {@value #baseName} i18n base
* @see AdminTest
* @see #translator()
* @see #translator(Locale,boolean)
* @return {@link Translator} */
public Translator translator(Locale locale)
{
return new Translator( baseName, locale, this.silentlyIgnoreMissingResourceException );
}
/**
* Returns a new {@link Translator} instance using the internal {@link Locale} and based on the {@value #baseName} i18n base
* @see AdminTest
* @see #translator(Locale)
* @see #translator(Locale,boolean)
* @return {@link Translator} */
public Translator translator()
{
return translator( this.locale );
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy