Search in sources :

Example 1 with Serializable

use of ch.cyberduck.core.Serializable in project cyberduck by iterate-ch.

the class PlistSerializer method setListForKey.

@Override
public <T extends Serializable> void setListForKey(final Collection<T> value, final String key) {
    final NSArray list = new NSArray(value.size());
    int i = 0;
    for (Serializable serializable : value) {
        list.setValue(i, serializable.<NSDictionary>serialize(new PlistSerializer()));
        i++;
    }
    dict.put(key, list);
}
Also used : Serializable(ch.cyberduck.core.Serializable) NSArray(com.dd.plist.NSArray)

Example 2 with Serializable

use of ch.cyberduck.core.Serializable in project cyberduck by iterate-ch.

the class PlistSerializer method setListForKey.

@Override
public <T extends Serializable> void setListForKey(final Collection<T> value, final String key) {
    final NSMutableArray list = NSMutableArray.array();
    for (Serializable serializable : value) {
        list.addObject(serializable.<NSDictionary>serialize(new PlistSerializer()));
    }
    dict.setObjectForKey(list, key);
}
Also used : Serializable(ch.cyberduck.core.Serializable) NSMutableArray(ch.cyberduck.binding.foundation.NSMutableArray)

Aggregations

Serializable (ch.cyberduck.core.Serializable)2 NSMutableArray (ch.cyberduck.binding.foundation.NSMutableArray)1 NSArray (com.dd.plist.NSArray)1