com.codepulsar.nils.api.NilsConfig Maven / Gradle / Ivy
Show all versions of nils-core Show documentation
package com.codepulsar.nils.api;
import java.time.format.FormatStyle;
import com.codepulsar.nils.api.adapter.AdapterFactory;
import com.codepulsar.nils.core.handler.ClassPrefixResolver;
import com.codepulsar.nils.core.handler.TranslationFormatter;
/** The configuration of the Nils library. */
public interface NilsConfig> {
/**
* Gets the escape pattern if a translation is missing, but no exception should be thrown.
*
* The escape pattern must contain {0}
.
*
* @return The pattern.
* @see #isSuppressErrors()
* @see #escapePattern(String)
*/
String getEscapePattern();
/**
* Sets the escape pattern if a translation is missing, but no exception should be thrown.
*
*
The escape pattern must contain {0}
.
*
* @param escapePattern the pattern
* @return This config object.
* @see #isSuppressErrors()
* @see #getEscapePattern()
*/
CFG escapePattern(String escapePattern);
/**
* Gets the tag for include translations from other key.
*
*
The default value is _include
.
*
* @return The tag used including translations.
* @see #includeTag(String)
*/
String getIncludeTag();
/**
* Sets the tag for include translations from other key.
*
* @param includeTag The tag used including translations.
* @return This config object.
* @see #getIncludeTag()
*/
CFG includeTag(String includeTag);
/**
* Gets the flag, if errors and exceptions should be suppressed during runtime.
*
*
The default value is false
.
*
* @return The value of the flag
* @see #suppressErrors(boolean)
*/
boolean isSuppressErrors();
/**
* Sets the flag, if errors and exceptions should be suppressed during runtime.
*
*
The default value is false
.
*
* @param suppressErrors The value of the flag
* @return This config object.
* @see #isSuppressErrors()
*/
CFG suppressErrors(boolean suppressErrors);
/**
* Gets the {@link ClassPrefixResolver} object.
*
*
The default is {@link ClassPrefixResolver#SIMPLE_CLASSNAME}.
*
* @return The {@link ClassPrefixResolver}.
* @see #classPrefixResolver(ClassPrefixResolver)
*/
ClassPrefixResolver getClassPrefixResolver();
/**
* Sets the {@link ClassPrefixResolver} object.
*
* @param classPrefixResolver The {@link ClassPrefixResolver}.
* @return This config object.
* @see #getClassPrefixResolver()
*/
CFG classPrefixResolver(ClassPrefixResolver classPrefixResolver);
/**
* Gets the {@link TranslationFormatter} object.
*
*
The default is {@link TranslationFormatter#MESSAGE_FORMAT}.
*
* @return The {@link TranslationFormatter}.
* @see #translationFormatter(TranslationFormatter)
*/
TranslationFormatter getTranslationFormatter();
/**
* Sets the {@link TranslationFormatter} object.
*
* @param translationFormatter The {@link TranslationFormatter}.
* @return This config object.
* @see #getTranslationFormatter()
*/
CFG translationFormatter(TranslationFormatter translationFormatter);
/**
* Gets the FormatStyle
used in {@link Formats} objects, defining the style for date,
* time and date with time value.
*
*
The default is FormatStyle.MEDIUM
.
*
* @return The FormatStyle
.
* @see #dateFormatStyle(FormatStyle)
*/
FormatStyle getDateFormatStyle();
/**
* Sets the FormatStyle
used in {@link Formats} objects, defining the style for date,
* time and date with time value.
*
*
The default is FormatStyle.MEDIUM
.
*
* @param dateFormatStyle The FormatStyle
.
* @return This config object.
* @see #getDateFormatStyle()
* @see com.codepulsar.nils.api.Formats
*/
CFG dateFormatStyle(FormatStyle dateFormatStyle);
/**
* Class of the {@link AdapterFactory}.
*
*
the class must have an parameter less constructor.
*
* @return The Class of the AdapterFactory.
*/
Class extends AdapterFactory>> getFactoryClass();
}