Search in sources :

Example 21 with EzyObject

use of com.tvd12.ezyfox.entity.EzyObject in project dahlia by youngmonkeys.

the class SettingCollectionSerializer method serialize.

@Override
public byte[] serialize(CollectionSetting setting) {
    EzyObject object = collectionToObject(setting);
    byte[] bytes = objectSerializer.serialize(object);
    return bytes;
}
Also used : EzyObject(com.tvd12.ezyfox.entity.EzyObject)

Example 22 with EzyObject

use of com.tvd12.ezyfox.entity.EzyObject in project dahlia by youngmonkeys.

the class SettingDatabaseDeserializer method deserialize.

@Override
public DatabaseSetting deserialize(byte[] bytes) {
    EzyObject object = objectDeserializer.deserialize(bytes);
    DatabaseSetting setting = new DatabaseSetting();
    setting.setDatabaseId(object.get(SettingFields.ID, int.class));
    return setting;
}
Also used : DatabaseSetting(com.tvd12.dahlia.core.setting.DatabaseSetting) EzyObject(com.tvd12.ezyfox.entity.EzyObject)

Example 23 with EzyObject

use of com.tvd12.ezyfox.entity.EzyObject in project dahlia by youngmonkeys.

the class SettingObjectToFields method toSetting.

public FieldSetting toSetting(EzyObject object) {
    DataType type = DataType.valueOf(object.get(SettingFields.TYPE));
    SettingObjectToField mapper = mappers.get(type);
    FieldSetting answer = mapper.toSetting(this, object);
    return answer;
}
Also used : FieldSetting(com.tvd12.dahlia.core.setting.FieldSetting) DataType(com.tvd12.dahlia.core.data.DataType)

Example 24 with EzyObject

use of com.tvd12.ezyfox.entity.EzyObject in project dahlia by youngmonkeys.

the class SettingObjectToFields method toFieldSettings.

public Map<String, FieldSetting> toFieldSettings(EzyArray array) {
    Map<String, FieldSetting> fields = new HashMap<>();
    for (int i = 0; i < array.size(); ++i) {
        EzyObject object = array.get(i);
        String name = object.get(SettingFields.NAME);
        FieldSetting field = toSetting(object);
        fields.put(name, field);
    }
    return fields;
}
Also used : FieldSetting(com.tvd12.dahlia.core.setting.FieldSetting) HashMap(java.util.HashMap) EzyObject(com.tvd12.ezyfox.entity.EzyObject)

Example 25 with EzyObject

use of com.tvd12.ezyfox.entity.EzyObject in project dahlia by youngmonkeys.

the class SettingObjectToFloatField method newSetting.

@Override
protected FieldFloatSetting newSetting(SettingObjectToFields mappers, EzyObject object) {
    FieldFloatSetting setting = new FieldFloatSetting();
    setting.setDefaultValue(object.get(SettingFields.DEFAULT, float.class));
    return setting;
}
Also used : FieldFloatSetting(com.tvd12.dahlia.core.setting.FieldFloatSetting)

Aggregations

EzyObject (com.tvd12.ezyfox.entity.EzyObject)37 FieldSetting (com.tvd12.dahlia.core.setting.FieldSetting)19 EzyArray (com.tvd12.ezyfox.entity.EzyArray)17 CollectionSetting (com.tvd12.dahlia.core.setting.CollectionSetting)12 Collection (com.tvd12.dahlia.core.entity.Collection)11 Record (com.tvd12.dahlia.core.entity.Record)9 CollectionStorage (com.tvd12.dahlia.core.storage.CollectionStorage)9 HashMap (java.util.HashMap)6 RecordConsumer (com.tvd12.dahlia.core.function.RecordConsumer)5 DatabaseSetting (com.tvd12.dahlia.core.setting.DatabaseSetting)5 CollectionNotFoundException (com.tvd12.dahlia.exception.CollectionNotFoundException)5 DuplicatedIdException (com.tvd12.dahlia.exception.DuplicatedIdException)5 ArrayList (java.util.ArrayList)5 CollectionExistedException (com.tvd12.dahlia.exception.CollectionExistedException)4 DatabaseExistedException (com.tvd12.dahlia.exception.DatabaseExistedException)4 FindOptions (com.tvd12.dahlia.query.FindOptions)4 CommandCount (com.tvd12.dahlia.core.command.CommandCount)3 CommandFind (com.tvd12.dahlia.core.command.CommandFind)3 CommandInsertOne (com.tvd12.dahlia.core.command.CommandInsertOne)3 FieldLongSetting (com.tvd12.dahlia.core.setting.FieldLongSetting)3