Search in sources :

Example 56 with EzyObject

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

the class FieldSimpleWriters method write.

@Override
public void write(FileProxy file, Map<String, FieldSetting> settings, EzyObject values) throws IOException {
    for (Entry<String, FieldSetting> e : settings.entrySet()) {
        Object value = values.get(e.getKey());
        write(file, e.getKey(), e.getValue(), value);
    }
}
Also used : FieldSetting(com.tvd12.dahlia.core.setting.FieldSetting) EzyObject(com.tvd12.ezyfox.entity.EzyObject)

Example 57 with EzyObject

use of com.tvd12.ezyfox.entity.EzyObject in project ezyfox-server-example by tvd12.

the class SocketClientSetup method setup.

public void setup(EzyClient client, boolean useUdp) {
    int count = counter.incrementAndGet();
    EzySetup setup = client.setup();
    setup.addDataHandler(EzyCommand.HANDSHAKE, new HandshakeHandler(count));
    setup.addDataHandler(EzyCommand.LOGIN, new LoginSuccessHandler(useUdp));
    setup.addDataHandler(EzyCommand.UDP_HANDSHAKE, new UdpHandshakeHandler());
    setup.addDataHandler(EzyCommand.APP_ACCESS, new AccessAppHandler(useUdp, messageCount, executorService));
    EzyAppSetup appSetup = setup.setupApp("hello-world");
    appSetup.addDataHandler("broadcastMessage", (app, data) -> {
    // String message = ((EzyObject)data).get("message", String.class);
    // System.out.println("tcp > server response: " + message);
    });
    appSetup.addDataHandler("udpBroadcastMessage", (app, data) -> {
    // String message = ((EzyObject)data).get("message", String.class);
    // System.out.println("udp > server response: " + message);
    });
}
Also used : UdpHandshakeHandler(com.tvd12.ezyfoxserver.stresstest.handler.UdpHandshakeHandler) HandshakeHandler(com.tvd12.ezyfoxserver.stresstest.handler.HandshakeHandler) EzyAppSetup(com.tvd12.ezyfoxserver.client.setup.EzyAppSetup) UdpHandshakeHandler(com.tvd12.ezyfoxserver.stresstest.handler.UdpHandshakeHandler) LoginSuccessHandler(com.tvd12.ezyfoxserver.stresstest.handler.LoginSuccessHandler) EzySetup(com.tvd12.ezyfoxserver.client.setup.EzySetup) AccessAppHandler(com.tvd12.ezyfoxserver.stresstest.handler.AccessAppHandler)

Example 58 with EzyObject

use of com.tvd12.ezyfox.entity.EzyObject in project ezyfox-server-android-client by youngmonkeys.

the class EzyArrayToList method toList.

@SuppressWarnings({ "rawtypes", "unchecked" })
public List toList(EzyArray array) {
    List answer = new ArrayList<>();
    for (int i = 0; i < array.size(); ++i) {
        Object item = array.get(i);
        Object sitem = item;
        if (item != null) {
            EzyObjectToMap objectToMap = EzyObjectToMap.getInstance();
            if (item instanceof EzyObject)
                sitem = objectToMap.toMap((EzyObject) item);
            else if (item instanceof EzyArray)
                sitem = toList((EzyArray) item);
        }
        answer.add(sitem);
    }
    return answer;
}
Also used : ArrayList(java.util.ArrayList) EzyArray(com.tvd12.ezyfoxserver.client.entity.EzyArray) List(java.util.List) ArrayList(java.util.ArrayList) EzyObject(com.tvd12.ezyfoxserver.client.entity.EzyObject) EzyObject(com.tvd12.ezyfoxserver.client.entity.EzyObject)

Example 59 with EzyObject

use of com.tvd12.ezyfox.entity.EzyObject in project ezyfox-server-android-client by youngmonkeys.

the class EzyEntityObjects method newObject.

public static EzyObject newObject(Map map) {
    EzyObject obj = EzyEntityFactory.newObject();
    obj.putAll(map);
    return obj;
}
Also used : EzyObject(com.tvd12.ezyfoxserver.client.entity.EzyObject)

Example 60 with EzyObject

use of com.tvd12.ezyfox.entity.EzyObject in project ezyfox-server-android-client by youngmonkeys.

the class EzyEntityObjects method newObject.

public static EzyObject newObject(Object key, Object value) {
    EzyObject obj = EzyEntityFactory.newObject();
    obj.put(key, value);
    return obj;
}
Also used : EzyObject(com.tvd12.ezyfoxserver.client.entity.EzyObject)

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