当前位置: 首页>>代码示例>>Java>>正文


Java Link类代码示例

本文整理汇总了Java中com.rometools.rome.feed.atom.Link的典型用法代码示例。如果您正苦于以下问题:Java Link类的具体用法?Java Link怎么用?Java Link使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Link类属于com.rometools.rome.feed.atom包,在下文中一共展示了Link类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildFeedMetadata

import com.rometools.rome.feed.atom.Link; //导入依赖的package包/类
@Override
protected void buildFeedMetadata(Map<String, Object> model, Feed feed, HttpServletRequest request) {
	feed.setId("https://github.com/mploed/event-driven-spring-boot/customer");
	feed.setTitle("Customer");
	List<Link> alternateLinks = new ArrayList<>();
	Link link = new Link();
	link.setRel("self");
	link.setHref(baseUrl(request) + "feed");
	alternateLinks.add(link);
	List<SyndPerson> authors = new ArrayList<SyndPerson>();
	Person person = new Person();
	person.setName("Big Pug Bank");
	authors.add(person);
	feed.setAuthors(authors);

	feed.setAlternateLinks(alternateLinks);
	feed.setUpdated(customerRepository.lastUpdate());
	Content subtitle = new Content();
	subtitle.setValue("List of all customers");
	feed.setSubtitle(subtitle);
}
 
开发者ID:mploed,项目名称:event-driven-spring-boot,代码行数:22,代码来源:CustomerAtomFeedView.java

示例2: buildFeedMetadata

import com.rometools.rome.feed.atom.Link; //导入依赖的package包/类
@Override
protected void buildFeedMetadata(Map<String, Object> model, Feed feed, HttpServletRequest request) {
	feed.setId("tag:ewolff.com/microservice-atom/order");
	feed.setTitle("Order");
	List<Link> alternateLinks = new ArrayList<>();
	Link link = new Link();
	link.setRel("self");
	link.setHref(baseUrl(request) + "feed");
	alternateLinks.add(link);
	List<SyndPerson> authors = new ArrayList<SyndPerson>();
	Person person = new Person();
	person.setName("Big Money Online Commerce Inc.");
	authors.add(person);
	feed.setAuthors(authors);

	feed.setAlternateLinks(alternateLinks);
	feed.setUpdated(orderRepository.lastUpdate());
	Content subtitle = new Content();
	subtitle.setValue("List of all orders");
	feed.setSubtitle(subtitle);
}
 
开发者ID:ewolff,项目名称:microservice-atom,代码行数:22,代码来源:OrderAtomFeedView.java

示例3: generateLinkElement

import com.rometools.rome.feed.atom.Link; //导入依赖的package包/类
protected Element generateLinkElement(final Link link) {
    final Element linkElement = new Element("link", OS_NS);

    if (link.getRel() != null) {
        final Attribute relAttribute = new Attribute("rel", "search");
        linkElement.setAttribute(relAttribute);
    }

    if (link.getType() != null) {
        final Attribute typeAttribute = new Attribute("type", link.getType());
        linkElement.setAttribute(typeAttribute);
    }

    if (link.getHref() != null) {
        final Attribute hrefAttribute = new Attribute("href", link.getHref());
        linkElement.setAttribute(hrefAttribute);
    }

    if (link.getHreflang() != null) {
        final Attribute hreflangAttribute = new Attribute("hreflang", link.getHreflang());
        linkElement.setAttribute(hreflangAttribute);
    }
    return linkElement;
}
 
开发者ID:rometools,项目名称:rome,代码行数:25,代码来源:OpenSearchModuleGenerator.java

示例4: clone

import com.rometools.rome.feed.atom.Link; //导入依赖的package包/类
@Override
public Object clone() {
    final AtomLinkModuleImpl m = new AtomLinkModuleImpl();
    List<Link> result = new LinkedList<Link>();
    for(Link link : this.getLinks()) {
        Link l = new Link();
        l.setHref(link.getHref());
        l.setType(link.getType());
        l.setRel(link.getRel());
        l.setHreflang(link.getHreflang());
        l.setTitle(link.getTitle());
        l.setLength(link.getLength());
        result.add(l);
    }
    links.subList(0, links.size());
    m.setLinks(result);
    return m;
}
 
开发者ID:rometools,项目名称:rome,代码行数:19,代码来源:AtomLinkModuleImpl.java

示例5: generateLinkElement

import com.rometools.rome.feed.atom.Link; //导入依赖的package包/类
protected Element generateLinkElement(final Link link) {

        final Element linkElement = new Element("link", getFeedNamespace());

        final String rel = link.getRel();
        if (rel != null) {
            final Attribute relAttribute = new Attribute("rel", rel);
            linkElement.setAttribute(relAttribute);
        }

        final String type = link.getType();
        if (type != null) {
            final Attribute typeAttribute = new Attribute("type", type);
            linkElement.setAttribute(typeAttribute);
        }

        final String href = link.getHref();
        if (href != null) {
            final Attribute hrefAttribute = new Attribute("href", href);
            linkElement.setAttribute(hrefAttribute);
        }

        return linkElement;

    }
 
开发者ID:rometools,项目名称:rome,代码行数:26,代码来源:Atom03Generator.java

示例6: parseLink

import com.rometools.rome.feed.atom.Link; //导入依赖的package包/类
private Link parseLink(final Element eLink) {

        final Link link = new Link();

        final String rel = getAttributeValue(eLink, "rel");
        if (rel != null) {
            link.setRel(rel);
        }

        final String type = getAttributeValue(eLink, "type");
        if (type != null) {
            link.setType(type);
        }

        final String href = getAttributeValue(eLink, "href");
        if (href != null) {
            link.setHref(href);
        }

        return link;

    }
 
开发者ID:rometools,项目名称:rome,代码行数:23,代码来源:Atom03Parser.java

示例7: parseLinks

import com.rometools.rome.feed.atom.Link; //导入依赖的package包/类
private List<Link> parseLinks(final List<Element> eLinks, final boolean alternate) {

        final List<Link> links = new ArrayList<Link>();

        for (final Element eLink : eLinks) {
            final String rel = getAttributeValue(eLink, "rel");
            if (alternate) {
                if ("alternate".equals(rel)) {
                    links.add(parseLink(eLink));
                }
            } else {
                if (!"alternate".equals(rel)) {
                    links.add(parseLink(eLink));
                }
            }
        }

        return Lists.emptyToNull(links);

    }
 
开发者ID:rometools,项目名称:rome,代码行数:21,代码来源:Atom03Parser.java

示例8: buildFeedEntries

import com.rometools.rome.feed.atom.Link; //导入依赖的package包/类
@Override
protected List<Entry> buildFeedEntries(Map<String, Object> model,
		HttpServletRequest req, HttpServletResponse response) throws Exception {
	// get data model which is passed by the Spring container
	  List<HrmsNews> news = (List<HrmsNews>) model.get("allNews");
       List<Entry> entries = new ArrayList<Entry>(news.size());
		
		for(HrmsNews topic : news ){
		
			Entry entry = new Entry();
			
			
			entry.setId(topic.getId()+"");
						
			entry.setTitle(topic.getDescription());
			
			Content summary = new Content();
			summary.setValue(topic.getSummary());
		    entry.setSummary(summary);
		       
		    Link link = new Link();
		    link.setType("text/html");
		    link.setHref(topic.getLink()); //because I have a different controller to show news at http://yourfanstasticsiteUrl.com/news/ID
		    List arrLinks = new ArrayList();
		    arrLinks.add(link);
		    entry.setAlternateLinks(arrLinks);
		    entry.setUpdated(new Date());
			
		    entries.add(entry);
		}
		
		return entries;
}
 
开发者ID:PacktPublishing,项目名称:Spring-MVC-Blueprints,代码行数:34,代码来源:HrmsAtomViewBuilder.java

示例9: toLink

import com.rometools.rome.feed.atom.Link; //导入依赖的package包/类
private Link toLink(OPDSLink opdsLinkI) {
    Link link = new Link();
    link.setHref(opdsLinkI.getHref());
    link.setRel(opdsLinkI.getRel());
    link.setType(opdsLinkI.getType());
    return link;
}
 
开发者ID:patexoid,项目名称:ZombieLib2,代码行数:8,代码来源:OpdsView.java

示例10: getAvatar

import com.rometools.rome.feed.atom.Link; //导入依赖的package包/类
/**
 * Get the value of avatar
 *
 * @return the value of avatar
 */
public Link getAvatar() {
    final Link result = findRelatedLink("avatar");
    if (result != null) {
        return result;
    }
    return findRelatedLink("userpic");
}
 
开发者ID:rometools,项目名称:rome,代码行数:13,代码来源:Person.java

示例11: setAvatar

import com.rometools.rome.feed.atom.Link; //导入依赖的package包/类
/**
 * Set the value of avatar
 *
 * @param newavatar new value of avatar
 */
public void setAvatar(final Link newavatar) {
    final Link old = getAvatar();
    if (old != null) {
        getOtherLinks().remove(old);
    }
    newavatar.setRel("avatar");
    getOtherLinks().add(newavatar);
}
 
开发者ID:rometools,项目名称:rome,代码行数:14,代码来源:Person.java

示例12: setThumbnail

import com.rometools.rome.feed.atom.Link; //导入依赖的package包/类
/**
 * Set the value of thumbnail
 *
 * @param newthumbnail new value of thumbnail
 */
public void setThumbnail(final Link newthumbnail) {
    Link old = null;
    for (final Link l : getOtherLinks()) {
        if ("thumbnail".equals(l.getRel())) {
            old = l;
            break;
        }
    }
    if (old != null) {
        getOtherLinks().remove(old);
        newthumbnail.setRel("thumbnail");
    }
    getOtherLinks().add(newthumbnail);
}
 
开发者ID:rometools,项目名称:rome,代码行数:20,代码来源:Bookmark.java

示例13: getLink

import com.rometools.rome.feed.atom.Link; //导入依赖的package包/类
@Override
public Link getLink() {
    if(links.size() > 0) {
        return links.get(0);
    }
    return null;
}
 
开发者ID:rometools,项目名称:rome,代码行数:8,代码来源:AtomLinkModuleImpl.java

示例14: setLink

import com.rometools.rome.feed.atom.Link; //导入依赖的package包/类
@Override
public void setLink(Link link) {
    if(links.size() > 0) {
        links.set(0, link);
    } else {
        links.add(link);
    }
}
 
开发者ID:rometools,项目名称:rome,代码行数:9,代码来源:AtomLinkModuleImpl.java

示例15: copyFrom

import com.rometools.rome.feed.atom.Link; //导入依赖的package包/类
@Override
public void copyFrom(CopyFrom obj) {
    AtomLinkModule other = (AtomLinkModule) obj;
    List<Link> links = other.getLinks();
    for (Link link : links) {
        Link l = new Link();
        l.setHref(link.getHref());
        l.setType(link.getType());
        l.setRel(link.getRel());
        l.setHreflang(link.getHreflang());
        l.setTitle(link.getTitle());
        l.setLength(link.getLength());
        this.links.add(l);
    }
}
 
开发者ID:rometools,项目名称:rome,代码行数:16,代码来源:AtomLinkModuleImpl.java


注:本文中的com.rometools.rome.feed.atom.Link类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。