HrefListProperty.kt 870 Bytes
Newer Older
Ricki Hirner's avatar
Ricki Hirner committed
1
/*
Ricki Hirner's avatar
Ricki Hirner committed
2 3 4
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
Ricki Hirner's avatar
Ricki Hirner committed
5 6 7 8 9 10 11 12 13 14 15 16 17 18
 */

package at.bitfire.dav4android.property

import at.bitfire.dav4android.Property
import at.bitfire.dav4android.PropertyFactory
import at.bitfire.dav4android.XmlUtils
import org.xmlpull.v1.XmlPullParser
import java.util.*

abstract class HrefListProperty: Property {

    val hrefs = LinkedList<String>()

Ricki Hirner's avatar
Ricki Hirner committed
19
    override fun toString() =  "href=[" + hrefs.joinToString(", ") + "]"
Ricki Hirner's avatar
Ricki Hirner committed
20 21 22 23 24 25 26 27 28 29 30 31


    abstract class Factory: PropertyFactory {

        fun create(parser: XmlPullParser, list: HrefListProperty): HrefListProperty {
            XmlUtils.readTextPropertyList(parser, Property.Name(XmlUtils.NS_WEBDAV, "href"), list.hrefs)
            return list
        }

    }

}