workspace.java

来自「编写rest实例 rest分布式框架在app中的应用」· Java 代码 · 共 57 行

JAVA
57
字号
package com.jeffhanson.atompub.introspect;

import java.util.ArrayList;
import java.util.Iterator;

import org.w3c.dom.Node;

import com.jeffhanson.atompub.DOMUtils;

public class Workspace
{
  private Node node = null;

  private ArrayList<com.jeffhanson.atompub.introspect.CollectionNode> collections =
    new ArrayList<com.jeffhanson.atompub.introspect.CollectionNode>();

  private String title = "";

  public Workspace(Node node)
  {
    this.node = node;
    
    Node titleNode = DOMUtils.getChildNode(node, "atom:title");
    if (titleNode == null)
    {
      titleNode = DOMUtils.getChildNode(node, "title");
    }
    
    if (titleNode != null)
    {
      title = titleNode.getTextContent();
    }
    
    Iterator<Node> childNodes = DOMUtils.getChildNodes(node,
                                                       "collection");
    while (childNodes.hasNext())
    {
      collections.add(new com.jeffhanson.atompub.introspect.CollectionNode(childNodes.next()));
    }
  }

  public Iterator<com.jeffhanson.atompub.introspect.CollectionNode> getCollections()
  {
    return collections.iterator();
  }

  public Node getNode()
  {
    return node;
  }

  public String getTitle()
  {
    return title;
  }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?