public final class MultilingualStringHelper extends Object
MultilingualString metadata| Modifier and Type | Field and Description |
|---|---|
static Locale |
DEFAULT_LOCALE
The default locale
|
| Modifier | Constructor and Description |
|---|---|
private |
MultilingualStringHelper() |
| Modifier and Type | Method and Description |
|---|---|
static String |
getValue(CompositeMetadata parentMetadata,
String metadataName,
Locale locale)
Returns the closest non-empty value for a
MultilingualString metadata in a given locale. |
static String |
getValue(MultilingualString multilingualString,
Locale locale)
Returns the closest non-empty value for a
MultilingualString in a given locale. |
static List<Locale> |
localeLookupList(Locale locale)
Return the list of closest locales to search
|
static Map<String,Object> |
toJson(MultilingualString multilingualString)
Get the JSON representation of a
MultilingualString |
public static final Locale DEFAULT_LOCALE
private MultilingualStringHelper()
public static String getValue(CompositeMetadata parentMetadata, String metadataName, Locale locale) throws AmetysRepositoryException
MultilingualString metadata in a given locale.
If no close locale is found, return the value for Locale.ENGLISH if exists.parentMetadata - The metadata holdermetadataName - The metadata namelocale - The requested localenull if not found.AmetysRepositoryException - if an errors occurs.public static String getValue(MultilingualString multilingualString, Locale locale) throws AmetysRepositoryException
MultilingualString in a given locale.
If no close locale is found, return the value for Locale.ENGLISH if exists.multilingualString - The multilingual stringlocale - The requested locale. Can be null.null if not found.AmetysRepositoryException - if an errors occurs.public static List<Locale> localeLookupList(Locale locale)
locale - the locale to start from. If null, returns the default localepublic static Map<String,Object> toJson(MultilingualString multilingualString) throws AmetysRepositoryException
MultilingualStringmultilingualString - The multilingual string. Cannot be null.AmetysRepositoryException - if an error occurs