aboutsummaryrefslogtreecommitdiff
path: root/juick-rss/src/main/java/com/juick/rss/extension/JuickModuleParser.java
blob: 7d6ba8ccd7014e4580e8a06ff4ad4c0faccf7b03 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package com.juick.rss.extension;

import com.rometools.rome.feed.module.Module;
import com.rometools.rome.io.ModuleParser;
import org.apache.commons.lang3.math.NumberUtils;
import org.jdom2.Element;

import java.util.Locale;

/**
 * Created by vitalyster on 13.12.2016.
 */
public class JuickModuleParser implements ModuleParser {
    @Override
    public String getNamespaceUri() {
        return JuickModule.URI;
    }

    @Override
    public Module parse(Element element, Locale locale) {
        JuickModuleImpl juickModule = new JuickModuleImpl();
        juickModule.setUid(NumberUtils.toInt(element.getAttributeValue("uid", JuickModule.URI), 0));
        return juickModule;
    }
}