📄 gomentryimpl.java
字号:
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */package org.apache.lucene.gdata.gom.core;import java.util.LinkedList;import java.util.List;import javax.xml.namespace.QName;import javax.xml.stream.XMLStreamException;import org.apache.lucene.gdata.gom.AtomMediaType;import org.apache.lucene.gdata.gom.GOMAuthor;import org.apache.lucene.gdata.gom.GOMCategory;import org.apache.lucene.gdata.gom.GOMContent;import org.apache.lucene.gdata.gom.GOMContributor;import org.apache.lucene.gdata.gom.GOMEntry;import org.apache.lucene.gdata.gom.GOMExtension;import org.apache.lucene.gdata.gom.GOMId;import org.apache.lucene.gdata.gom.GOMLink;import org.apache.lucene.gdata.gom.GOMNamespace;import org.apache.lucene.gdata.gom.GOMPublished;import org.apache.lucene.gdata.gom.GOMRights;import org.apache.lucene.gdata.gom.GOMSource;import org.apache.lucene.gdata.gom.GOMSummary;import org.apache.lucene.gdata.gom.GOMTitle;import org.apache.lucene.gdata.gom.GOMUpdated;import org.apache.lucene.gdata.gom.core.extension.GOMExtensionFactory;import org.apache.lucene.gdata.gom.core.utils.AtomParserUtils;import org.apache.lucene.gdata.gom.writer.GOMOutputWriter;/** * * The default implementation of {@link org.apache.lucene.gdata.gom.GOMEntry} * * <pre> * atomEntry = * element atom:entry { * atomCommonAttributes, * ( atomAuthor* * & atomCategory* * & atomContent? * & atomContributor* * & atomId * & atomLink* * & atomPublished? * & atomRights? * & atomSource? * & atomSummary? * & atomTitle * & atomUpdated * & extensionElement*) * } * </pre> * * @author Simon Willnauer * */public class GOMEntryImpl extends AbstractGOMElement implements GOMEntry { protected List<GOMNamespace> namespaces = new LinkedList<GOMNamespace>(); protected List<GOMExtension> extensions = new LinkedList<GOMExtension>(); private List<GOMAuthor> authors = new LinkedList<GOMAuthor>(); private List<GOMCategory> categories = new LinkedList<GOMCategory>(); private List<GOMContributor> contributors = new LinkedList<GOMContributor>(); private GOMId id; private List<GOMLink> links = new LinkedList<GOMLink>(); private GOMPublished published; private GOMRights rights; private GOMSource source; private GOMSummary summary; private GOMTitle title; private GOMUpdated updated; private GOMExtensionFactory extensionFactory; private GOMContent content; private final GOMNamespace defaultNamespace = GOMNamespace.ATOM_NAMESPACE; /** * */ public GOMEntryImpl() { super(); this.localName = GOMEntry.LOCALNAME; this.qname = new QName(GOMNamespace.ATOM_NS_URI, this.localName); } /** * @see org.apache.lucene.gdata.gom.GOMEntry#addAuthor(org.apache.lucene.gdata.gom.GOMAuthor) */ public void addAuthor(GOMAuthor aAuthor) { if (aAuthor != null) this.authors.add(aAuthor); } /** * @see org.apache.lucene.gdata.gom.GOMEntry#addCategory(org.apache.lucene.gdata.gom.GOMCategory) */ public void addCategory(GOMCategory aCategory) { if (aCategory != null) this.categories.add(aCategory); } /** * @see org.apache.lucene.gdata.gom.GOMEntry#addContributor(org.apache.lucene.gdata.gom.GOMContributor) */ public void addContributor(GOMContributor aContributor) { if (aContributor != null) this.contributors.add(aContributor); } /** * @see org.apache.lucene.gdata.gom.GOMEntry#addLink(org.apache.lucene.gdata.gom.GOMLink) */ public void addLink(GOMLink aLink) { if (aLink != null) this.links.add(aLink); } /** * @see org.apache.lucene.gdata.gom.GOMEntry#getAuthors() */ public List<GOMAuthor> getAuthors() { return this.authors; } /** * @see org.apache.lucene.gdata.gom.GOMEntry#getCategories() */ public List<GOMCategory> getCategories() { return this.categories; } /** * @see org.apache.lucene.gdata.gom.GOMEntry#getContributor() */ public List<GOMContributor> getContributor() { return this.contributors; } /** * @see org.apache.lucene.gdata.gom.GOMEntry#getId() */ public GOMId getId() { return this.id; } /** * @see org.apache.lucene.gdata.gom.GOMEntry#getLinks() */ public List<GOMLink> getLinks() { return this.links; } /** * @see org.apache.lucene.gdata.gom.GOMEntry#getPublished() */ public GOMPublished getPublished() { return this.published; } /** * @see org.apache.lucene.gdata.gom.GOMEntry#getRights() */ public GOMRights getRights() { return this.rights; } /** * @see org.apache.lucene.gdata.gom.GOMEntry#getSource() */ public GOMSource getSource() { return this.source; } /** * @see org.apache.lucene.gdata.gom.GOMEntry#getSummary() */ /** * @see org.apache.lucene.gdata.gom.GOMEntry#getSummary() */ public GOMSummary getSummary() { return this.summary; } /** * @see org.apache.lucene.gdata.gom.GOMEntry#getTitle() */ public GOMTitle getTitle() { return this.title; } /** * @see org.apache.lucene.gdata.gom.GOMEntry#getUpdated() */ public GOMUpdated getUpdated() { return this.updated; } /** * @see org.apache.lucene.gdata.gom.GOMEntry#setId(org.apache.lucene.gdata.gom.GOMId) */ public void setId(GOMId aId) { this.id = aId; } /** * @see org.apache.lucene.gdata.gom.GOMEntry#setPublished(org.apache.lucene.gdata.gom.GOMPublished) */ public void setPublished(GOMPublished aPublished) { this.published = aPublished; } /** * @see org.apache.lucene.gdata.gom.GOMEntry#setRights(org.apache.lucene.gdata.gom.GOMRights) */ public void setRights(GOMRights aRights) { this.rights = aRights; } /** * @see org.apache.lucene.gdata.gom.GOMEntry#setSource(org.apache.lucene.gdata.gom.GOMSource) */ public void setSource(GOMSource aSource) { this.source = aSource; } /** * @see org.apache.lucene.gdata.gom.GOMEntry#setSummary(org.apache.lucene.gdata.gom.GOMSummary) */ public void setSummary(GOMSummary aSummary) { this.summary = aSummary; } /** * @see org.apache.lucene.gdata.gom.GOMEntry#setTitle(org.apache.lucene.gdata.gom.GOMTitle) */ public void setTitle(GOMTitle aTitle) { this.title = aTitle; } /** * @see org.apache.lucene.gdata.gom.GOMEntry#setUpdated(org.apache.lucene.gdata.gom.GOMUpdated) */ public void setUpdated(GOMUpdated aUpdated) { this.updated = aUpdated; } /** * @see org.apache.lucene.gdata.gom.GOMEntry#addNamespace(org.apache.lucene.gdata.gom.GOMNamespace) */ public void addNamespace(GOMNamespace aNamespace) { if (aNamespace == null) return; // namespace overrides hash / equals if (this.namespaces.contains(aNamespace)) return; if ("".equals(aNamespace.getNamespacePrefix()) || aNamespace.getNamespaceUri() .equals(GOMNamespace.ATOM_NS_URI)) return; else this.namespaces.add(aNamespace); } /** * @see org.apache.lucene.gdata.gom.GOMEntry#getNamespaces() */ public List<GOMNamespace> getNamespaces() { return this.namespaces; } /** * @see org.apache.lucene.gdata.gom.GOMEntry#getDefaultNamespace() */ public GOMNamespace getDefaultNamespace() { return this.defaultNamespace; } /** * @see org.apache.lucene.gdata.gom.GOMElement#writeAtomOutput(org.apache.lucene.gdata.gom.writer.GOMStaxWriter) */ public void writeAtomOutput(GOMOutputWriter aStreamWriter) throws XMLStreamException { aStreamWriter .writeStartElement(this.qname, getXmlNamespaceAttributes()); if (this.defaultNamespace != null) aStreamWriter.writeDefaultNamespace(this.defaultNamespace); for (GOMNamespace namespace : this.namespaces) { aStreamWriter.writeNamespace(namespace); } if (this.id != null) this.id.writeAtomOutput(aStreamWriter); if (this.published != null) this.published.writeAtomOutput(aStreamWriter); if (this.updated != null) this.updated.writeAtomOutput(aStreamWriter); for (GOMCategory category : this.categories) { category.writeAtomOutput(aStreamWriter); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -