本文整理汇总了Java中com.rometools.rome.feed.atom.Link类的典型用法代码示例。如果您正苦于以下问题:Java Link类的具体用法?Java Link怎么用?Java Link使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Link类属于com.rometools.rome.feed.atom包,在下文中一共展示了Link类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: generateLink
import com.rometools.rome.feed.atom.Link; //导入依赖的package包/类
private Element generateLink(Link link) {
Element linkElement = new Element("link", NS);
if (link.getHref() != null) {
Attribute href = new Attribute(AtomLinkAttribute.HREF, link.getHref());
linkElement.setAttribute(href);
}
if (link.getType() != null) {
Attribute type = new Attribute(AtomLinkAttribute.TYPE, link.getType());
linkElement.setAttribute(type);
}
if (link.getRel() != null) {
Attribute rel = new Attribute(AtomLinkAttribute.REL, link.getRel());
linkElement.setAttribute(rel);
}
if (link.getHreflang() != null) {
final Attribute hreflangAttribute = new Attribute(AtomLinkAttribute.HREF_LANG, link.getHreflang());
linkElement.setAttribute(hreflangAttribute);
}
if (link.getTitle() != null) {
final Attribute title = new Attribute(AtomLinkAttribute.TITLE, link.getTitle());
linkElement.setAttribute(title);
}
if (link.getLength() != 0) {
final Attribute length = new Attribute(AtomLinkAttribute.LENGTH, Long.toString(link.getLength()));
linkElement.setAttribute(length);
}
return linkElement;
}
开发者ID:rometools,项目名称:rome,代码行数:34,代码来源:AtomModuleGenerator.java
示例17: parse
import com.rometools.rome.feed.atom.Link; //导入依赖的package包/类
@Override
public Module parse(Element element, Locale locale) {
AtomLinkModuleImpl mod = new AtomLinkModuleImpl();
if (element.getName().equals("channel") || element.getName().equals("item")) {
List<Element> links = element.getChildren("link", NS);
List<Link> result = new LinkedList<Link>();
for (Element link : links) {
Link l = parseLink(link);
result.add(l);
}
mod.setLinks(result);
return mod;
}
return null;
}
开发者ID:rometools,项目名称:rome,代码行数:16,代码来源:AtomModuleParser.java
示例18: 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, AtomLinkAttribute.REL);
if (rel != null) {
link.setRel(rel);
}
final String type = getAttributeValue(eLink, AtomLinkAttribute.TYPE);
if (type != null) {
link.setType(type);
}
final String href = getAttributeValue(eLink, AtomLinkAttribute.HREF);
if (href != null) {
link.setHref(href);
}
final String title = getAttributeValue(eLink, AtomLinkAttribute.TITLE);
if (title != null) {
link.setTitle(title);
}
final String hrefLang = getAttributeValue(eLink, AtomLinkAttribute.HREF_LANG);
if (hrefLang != null) {
link.setHreflang(hrefLang);
}
final String length = getAttributeValue(eLink, AtomLinkAttribute.LENGTH);
if (length != null) {
final Long val = NumberParser.parseLong(length);
if (val != null) {
link.setLength(val.longValue());
}
}
return link;
}
开发者ID:rometools,项目名称:rome,代码行数:41,代码来源:AtomModuleParser.java
示例19: test
import com.rometools.rome.feed.atom.Link; //导入依赖的package包/类
public void test() throws Exception {
final File testdata = new File(super.getTestFile("atom/atom.xml"));
final SyndFeed feed = new SyndFeedInput().build(testdata);
final AtomLinkModule atomLinkModule = (AtomLinkModule) feed.getModule(AtomLinkModule.URI);
List<Link> links = atomLinkModule.getLinks();
for (int i = 0; i < links.size(); i++) {
Link link = links.get(i);
assertEquals(href[i], link.getHref());
assertEquals(rel[i], link.getRel());
assertEquals(type[i], link.getType());
}
}
开发者ID:rometools,项目名称:rome,代码行数:16,代码来源:AtomLinkTest.java
示例20: createSyndLinks
import com.rometools.rome.feed.atom.Link; //导入依赖的package包/类
protected List<SyndLink> createSyndLinks(final List<Link> atomLinks) {
final ArrayList<SyndLink> syndLinks = new ArrayList<SyndLink>();
for (final Link atomLink : atomLinks) {
final SyndLink syndLink = createSyndLink(atomLink);
syndLinks.add(syndLink);
}
return syndLinks;
}
开发者ID:rometools,项目名称:rome,代码行数:9,代码来源:ConverterForAtom10.java
注:本文中的com.rometools.rome.feed.atom.Link类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论