
com.contentful.java.cda.Cache Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-sdk Show documentation
Show all versions of java-sdk Show documentation
Java SDK for Contentful's Content Delivery API.
package com.contentful.java.cda;
import java.util.List;
import java.util.Map;
class Cache {
private List locales;
protected CDALocale defaultLocale;
private Map types;
private final Object localesLock = new Object();
private final Object typesLock = new Object();
List locales() {
return locales;
}
protected CDALocale defaultLocale() {
return defaultLocale;
}
void setLocales(List locales) {
synchronized (localesLock) {
this.locales = locales;
updateDefaultLocale();
}
}
void updateDefaultLocale() {
if (this.locales != null) {
for (final CDALocale locale : this.locales) {
if (locale.isDefaultLocale()) {
this.defaultLocale = locale;
}
}
}
}
Map types() {
synchronized (typesLock) {
return types;
}
}
void setTypes(Map types) {
synchronized (typesLock) {
this.types = types;
}
}
void clear() {
synchronized (localesLock) {
locales = null;
defaultLocale = null;
}
synchronized (typesLock) {
types = null;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy