Search in sources :

Example 26 with ExtWrapNullable

use of org.javarosa.core.util.externalizable.ExtWrapNullable in project javarosa by opendatakit.

the class Localizer method writeExternal.

/**
 * Writes the object to a stream.
 */
@Override
public void writeExternal(DataOutputStream dos) throws IOException {
    ExtUtil.writeBool(dos, fallbackDefaultLocale);
    ExtUtil.writeBool(dos, fallbackDefaultForm);
    ExtUtil.write(dos, new ExtWrapMap(localeResources, new ExtWrapListPoly()));
    ExtUtil.write(dos, new ExtWrapList(locales));
    ExtUtil.write(dos, new ExtWrapNullable(defaultLocale));
    ExtUtil.write(dos, new ExtWrapNullable(currentLocale));
}
Also used : ExtWrapListPoly(org.javarosa.core.util.externalizable.ExtWrapListPoly) ExtWrapMap(org.javarosa.core.util.externalizable.ExtWrapMap) ExtWrapList(org.javarosa.core.util.externalizable.ExtWrapList) ExtWrapNullable(org.javarosa.core.util.externalizable.ExtWrapNullable)

Example 27 with ExtWrapNullable

use of org.javarosa.core.util.externalizable.ExtWrapNullable in project javarosa by opendatakit.

the class Localizer method readExternal.

/* === (DE)SERIALIZATION === */
/**
 * Reads the object from a stream.
 */
@Override
public void readExternal(DataInputStream dis, PrototypeFactory pf) throws IOException, DeserializationException {
    fallbackDefaultLocale = ExtUtil.readBool(dis);
    fallbackDefaultForm = ExtUtil.readBool(dis);
    localeResources = (OrderedMap<String, List<LocaleDataSource>>) ExtUtil.read(dis, new ExtWrapMap(String.class, new ExtWrapListPoly(), ExtWrapMap.TYPE_ORDERED), pf);
    locales = (List<String>) ExtUtil.read(dis, new ExtWrapList(String.class));
    setDefaultLocale((String) ExtUtil.read(dis, new ExtWrapNullable(String.class), pf));
    String currentLocale = (String) ExtUtil.read(dis, new ExtWrapNullable(String.class), pf);
    if (currentLocale != null) {
        setLocale(currentLocale);
    }
}
Also used : ExtWrapListPoly(org.javarosa.core.util.externalizable.ExtWrapListPoly) ExtWrapMap(org.javarosa.core.util.externalizable.ExtWrapMap) ArrayList(java.util.ArrayList) ExtWrapList(org.javarosa.core.util.externalizable.ExtWrapList) List(java.util.List) ExtWrapList(org.javarosa.core.util.externalizable.ExtWrapList) ExtWrapNullable(org.javarosa.core.util.externalizable.ExtWrapNullable)

Aggregations

ExtWrapNullable (org.javarosa.core.util.externalizable.ExtWrapNullable)27 ExtWrapTagged (org.javarosa.core.util.externalizable.ExtWrapTagged)13 ExtWrapListPoly (org.javarosa.core.util.externalizable.ExtWrapListPoly)9 ExtWrapList (org.javarosa.core.util.externalizable.ExtWrapList)7 ExtWrapMap (org.javarosa.core.util.externalizable.ExtWrapMap)7 ArrayList (java.util.ArrayList)4 List (java.util.List)4 Date (java.util.Date)3 Condition (org.javarosa.core.model.condition.Condition)2 Recalculate (org.javarosa.core.model.condition.Recalculate)2 DeserializationException (org.javarosa.core.util.externalizable.DeserializationException)2 HashMap (java.util.HashMap)1 Constraint (org.javarosa.core.model.condition.Constraint)1 IConditionExpr (org.javarosa.core.model.condition.IConditionExpr)1 DataInstance (org.javarosa.core.model.instance.DataInstance)1 TreeElement (org.javarosa.core.model.instance.TreeElement)1 OSMTag (org.javarosa.core.model.osm.OSMTag)1 Localizer (org.javarosa.core.services.locale.Localizer)1 OrderedMap (org.javarosa.core.util.OrderedMap)1 ExtWrapBase (org.javarosa.core.util.externalizable.ExtWrapBase)1