Search in sources :

Example 1 with EzyArrayToList

use of com.tvd12.ezyfoxserver.client.util.EzyArrayToList in project ezyfox-server-android-client by youngmonkeys.

the class EzyArrayList method toList.

/*
     * (non-Javadoc)
     * @see com.tvd12.ezyfox.entity.EzyRoArray#toList()
     */
@Override
public List toList() {
    EzyArrayToList arrayToList = EzyArrayToList.getInstance();
    List list = arrayToList.toList(this);
    return list;
}
Also used : EzyArrayToList(com.tvd12.ezyfoxserver.client.util.EzyArrayToList) List(java.util.List) EzyArrayToList(com.tvd12.ezyfoxserver.client.util.EzyArrayToList) ArrayList(java.util.ArrayList)

Example 2 with EzyArrayToList

use of com.tvd12.ezyfoxserver.client.util.EzyArrayToList in project ezyfox-server-android-client by youngmonkeys.

the class EzyObjectToMap method toMap.

@SuppressWarnings({ "rawtypes", "unchecked" })
public Map toMap(EzyObject object) {
    Map answer = new HashMap<>();
    for (Object key : object.keySet()) {
        Object value = object.get(key);
        Object skey = key;
        EzyArrayToList arrayToList = EzyArrayToList.getInstance();
        if (key instanceof EzyArray)
            skey = arrayToList.toList((EzyArray) key);
        else if (key instanceof EzyObject)
            skey = toMap((EzyObject) key);
        Object svalue = value;
        if (value != null) {
            if (value instanceof EzyArray)
                svalue = arrayToList.toList((EzyArray) value);
            if (value instanceof EzyObject)
                svalue = toMap((EzyObject) value);
        }
        answer.put(skey, svalue);
    }
    return answer;
}
Also used : HashMap(java.util.HashMap) EzyArray(com.tvd12.ezyfoxserver.client.entity.EzyArray) EzyObject(com.tvd12.ezyfoxserver.client.entity.EzyObject) EzyObject(com.tvd12.ezyfoxserver.client.entity.EzyObject) Map(java.util.Map) HashMap(java.util.HashMap)

Aggregations

EzyArray (com.tvd12.ezyfoxserver.client.entity.EzyArray)1 EzyObject (com.tvd12.ezyfoxserver.client.entity.EzyObject)1 EzyArrayToList (com.tvd12.ezyfoxserver.client.util.EzyArrayToList)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1