Search in sources :

Example 1 with FieldObjectSetting

use of com.tvd12.dahlia.core.setting.FieldObjectSetting in project dahlia by youngmonkeys.

the class LocalCollectionSettingReader method readFieldObjectSetting.

protected FieldSetting readFieldObjectSetting(JSONObject setting) {
    FieldObjectSetting field = new FieldObjectSetting();
    if (setting.has(SettingFields.FIELDS)) {
        JSONObject fieldSettings = setting.getJSONObject(SettingFields.FIELDS);
        Map<String, FieldSetting> fields = readFieldSettings(fieldSettings);
        field.setFields(fields);
    } else {
        throw new IllegalArgumentException("'fields' is required");
    }
    return field;
}
Also used : FieldSetting(com.tvd12.dahlia.core.setting.FieldSetting) JSONObject(org.json.JSONObject) FieldObjectSetting(com.tvd12.dahlia.core.setting.FieldObjectSetting)

Example 2 with FieldObjectSetting

use of com.tvd12.dahlia.core.setting.FieldObjectSetting in project dahlia by youngmonkeys.

the class FieldObjectWriter method writeValue.

@Override
protected void writeValue(FieldWriters writers, FileProxy file, FieldSetting setting, EzyObject value) throws IOException {
    FieldObjectSetting fs = (FieldObjectSetting) setting;
    Map<String, FieldSetting> fieldSettings = fs.getFields();
    writers.write(file, fieldSettings, value);
}
Also used : FieldSetting(com.tvd12.dahlia.core.setting.FieldSetting) FieldObjectSetting(com.tvd12.dahlia.core.setting.FieldObjectSetting)

Example 3 with FieldObjectSetting

use of com.tvd12.dahlia.core.setting.FieldObjectSetting in project dahlia by youngmonkeys.

the class SettingObjectToObjectField method newSetting.

@Override
protected FieldObjectSetting newSetting(SettingObjectToFields mappers, EzyObject object) {
    FieldObjectSetting setting = new FieldObjectSetting();
    EzyArray fieldSettings = object.get(SettingFields.FIELDS, EzyArray.class);
    Map<String, FieldSetting> fields = mappers.toFieldSettings(fieldSettings);
    setting.setFields(fields);
    return setting;
}
Also used : FieldSetting(com.tvd12.dahlia.core.setting.FieldSetting) FieldObjectSetting(com.tvd12.dahlia.core.setting.FieldObjectSetting) EzyArray(com.tvd12.ezyfox.entity.EzyArray)

Example 4 with FieldObjectSetting

use of com.tvd12.dahlia.core.setting.FieldObjectSetting in project dahlia by youngmonkeys.

the class FieldObjectReader method readValue.

@Override
protected EzyObject readValue(FieldReaders readers, FileProxy file, FieldSetting setting) throws IOException {
    FieldObjectSetting fs = (FieldObjectSetting) setting;
    Map<String, FieldSetting> fieldSettings = fs.getFields();
    EzyObject object = EzyEntityFactory.newObject();
    readers.read(file, fieldSettings, object);
    return object;
}
Also used : FieldSetting(com.tvd12.dahlia.core.setting.FieldSetting) FieldObjectSetting(com.tvd12.dahlia.core.setting.FieldObjectSetting) EzyObject(com.tvd12.ezyfox.entity.EzyObject)

Aggregations

FieldObjectSetting (com.tvd12.dahlia.core.setting.FieldObjectSetting)4 FieldSetting (com.tvd12.dahlia.core.setting.FieldSetting)4 EzyArray (com.tvd12.ezyfox.entity.EzyArray)1 EzyObject (com.tvd12.ezyfox.entity.EzyObject)1 JSONObject (org.json.JSONObject)1