Java Doc for IDOMNode.java in  » IDE-Eclipse » jdt » org » eclipse » jdt » core » jdom » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Eclipse » jdt » org.eclipse.jdt.core.jdom 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.eclipse.jdt.core.jdom.IDOMNode

All known Subclasses:   org.eclipse.jdt.internal.core.jdom.DOMNode,
IDOMNode
public interface IDOMNode extends Cloneable(Code)
Nodes represent structural fragments of a Java source file, also known as document fragments. Their implementation is known as a DOM (Document Object Model) - in this case a JDOM (Java DOM). A root node (node with no parent or siblings) represents the root of a document fragment (DF). A complete Java document is represented by a compilation unit node (IDOMCompilationUnit). In this way, a DF is comprised of DFs, and a document itself (compilation unit) is also a DF.

A DF may be created empty and programmatically filled, or it may be created from a source code string. The IDOMFactory allows the creation of all kinds of nodes from source code strings. Manipulations performed on a DF are immediately reflected in the DF's contents.

Children fragments are represented as a linked list of nodes. Children are inserted via their parent node, and are automatically linked up with previous and next nodes.

The contents of any node (DF) may be retrieved at any time. In this way it is possible to retrieve source code representing fragments of the compilation unit (for example, a type or a method), since the contents of any node (not just the root node) may be obtained.

The following manipulations on DFs are distinct:

  • clone - this creates a stand-alone copy of the DF that is in no way dependent on the DF that it was cloned from
  • remove - this orphans a DF from its host DF. The removed DF may still be dependent on its previous host (perhaps to generate its contents), and hanging onto the fragment means that its previous host is also retained in memory.
  • add/insert - this splices an un-parented DF (one that has been cloned, removed, or created stand-alone), into an existing DF such that the newly inserted DF is only dependent on its new host.

Wherever types are specified in DOM APIs, type names must be specified as they would appear in source code. The DOM does not have a notion of type signatures, only raw text. Example type names are "Object", "java.io.File", and "int[]".

This interface is not intended to be implemented by clients.



Field Summary
public static  intCOMPILATION_UNIT
     Node type constant indicating a compilation unit.
public static  intFIELD
     Node type constant indicating a field declaration.
public static  intIMPORT
     Node type constant indicating an import declaration.
public static  intINITIALIZER
     Node type constant indicating an initializer declaration.
public static  intMETHOD
     Node type constant indicating a method (or constructor) declaration.
public static  intPACKAGE
     Node type constant indicating a package declaration.
public static  intTYPE
     Node type constant indicating a type declaration.


Method Summary
public  voidaddChild(IDOMNode child)
     Adds the given un-parented node (document fragment) as the last child of this node.
public  booleancanHaveChildren()
     Returns whether this node is allowed to have children.
public  Objectclone()
     Returns a stand-alone copy of the document fragment represented by this node that is in no way dependent on the document this node is part of.
public  char[]getCharacters()
     Returns the current contents of this document fragment as a character array.
public  IDOMNodegetChild(String name)
     Returns the first named child of this node with the given name.
public  EnumerationgetChildren()
     Returns an enumeration of children of this node.
public  StringgetContents()
     Returns the current contents of this document fragment.
public  IDOMNodegetFirstChild()
     Returns the first child of this node.
public  IJavaElementgetJavaElement(IJavaElement parent)
     Returns a handle for the Java element associated with this document fragment, based on the parent Java element.
public  StringgetName()
     Returns the name of this node.
public  IDOMNodegetNextNode()
     Returns the sibling node immediately following this node.
public  intgetNodeType()
     Returns the type of this node.
public  IDOMNodegetParent()
     Returns the parent of this node.
public  IDOMNodegetPreviousNode()
     Returns the sibling node immediately preceding this node.
public  voidinsertSibling(IDOMNode sibling)
     Inserts the given un-parented node as a sibling of this node, immediately before this node.
public  booleanisAllowableChild(IDOMNode node)
     Returns whether the given node is an allowable child for this node.
public  booleanisSignatureEqual(IDOMNode node)
     Returns whether this node's signature is equivalent to the given node's signature.
public  voidremove()
     Separates this node from its parent and siblings, maintaining any ties that this node has to the underlying document fragment.
public  voidsetName(String name)
     Sets the name of this node.

Field Detail
COMPILATION_UNIT
public static int COMPILATION_UNIT(Code)
Node type constant indicating a compilation unit. Nodes of this type maybe by safely cast to IDOMCompilationUnit.
See Also:   IDOMNode.getNodeType()



FIELD
public static int FIELD(Code)
Node type constant indicating a field declaration. Nodes of this type maybe by safely cast to IDOMField.
See Also:   IDOMNode.getNodeType()



IMPORT
public static int IMPORT(Code)
Node type constant indicating an import declaration. Nodes of this type maybe by safely cast to IDOMImport.
See Also:   IDOMNode.getNodeType()



INITIALIZER
public static int INITIALIZER(Code)
Node type constant indicating an initializer declaration. Nodes of this type maybe by safely cast to IDOMInitializer.
See Also:   IDOMNode.getNodeType()



METHOD
public static int METHOD(Code)
Node type constant indicating a method (or constructor) declaration. Nodes of this type maybe by safely cast to IDOMMethod.
See Also:   IDOMNode.getNodeType()



PACKAGE
public static int PACKAGE(Code)
Node type constant indicating a package declaration. Nodes of this type maybe by safely cast to IDOMPackage.
See Also:   IDOMNode.getNodeType()



TYPE
public static int TYPE(Code)
Node type constant indicating a type declaration. Nodes of this type maybe by safely cast to IDOMType.
See Also:   IDOMNode.getNodeType()





Method Detail
addChild
public void addChild(IDOMNode child) throws DOMException, IllegalArgumentException(Code)
Adds the given un-parented node (document fragment) as the last child of this node.
Parameters:
  child - the new child node
exception:
  DOMException - if any of the following conditions hold:
  • this node is not allowed to have children,
  • the child is not of an allowable type
  • the child already has a parent
  • the child is an ancestor of this node

exception:
  IllegalArgumentException - if the child is null
See Also:   IDOMNode.insertSibling(IDOMNode)
See Also:   IDOMNode.remove()



canHaveChildren
public boolean canHaveChildren()(Code)
Returns whether this node is allowed to have children. true if this node can have children



clone
public Object clone()(Code)
Returns a stand-alone copy of the document fragment represented by this node that is in no way dependent on the document this node is part of. a copy of type IDOMNode
See Also:   IDOMNode.addChild(IDOMNode)
See Also:   IDOMNode.insertSibling(IDOMNode)
See Also:   IDOMNode.remove()



getCharacters
public char[] getCharacters()(Code)
Returns the current contents of this document fragment as a character array.

Note: To obtain complete source for the source file, ask a compilation unit node for its contents.

the contents, or null if this node has no contents



getChild
public IDOMNode getChild(String name)(Code)
Returns the first named child of this node with the given name.
Parameters:
  name - the name the child node, or null if no such child exists



getChildren
public Enumeration getChildren()(Code)
Returns an enumeration of children of this node. Returns an empty enumeration if this node has no children (including nodes that cannot have children). Children appear in the order in which they are declared in the source code. an enumeration of the children



getContents
public String getContents()(Code)
Returns the current contents of this document fragment.

Note: To obtain complete source for the source file, ask a compilation unit node for its contents.

the contents, or null if this node has no contents



getFirstChild
public IDOMNode getFirstChild()(Code)
Returns the first child of this node. Children appear in the order in which they exist in the source code. the first child, or null if this node has no children
See Also:   IDOMNode.getChildren()



getJavaElement
public IJavaElement getJavaElement(IJavaElement parent) throws IllegalArgumentException(Code)
Returns a handle for the Java element associated with this document fragment, based on the parent Java element.
Parameters:
  parent - the parent Java element
exception:
  IllegalArgumentException - if the parent element is notof a valid parent type for this node a handle for the Java element associated with this document fragment, based on the parent Java element



getName
public String getName()(Code)
Returns the name of this node. More details are provided in each of the subtypes. the name, or null if it has no name



getNextNode
public IDOMNode getNextNode()(Code)
Returns the sibling node immediately following this node. the next node, or null if there is no following node



getNodeType
public int getNodeType()(Code)
Returns the type of this node. one of the node type constants defined in IDOMNode



getParent
public IDOMNode getParent()(Code)
Returns the parent of this node. the parent node, or null if this node does not have a parent



getPreviousNode
public IDOMNode getPreviousNode()(Code)
Returns the sibling node immediately preceding this node. the previous node, or null if there is no preceding node



insertSibling
public void insertSibling(IDOMNode sibling) throws DOMException, IllegalArgumentException(Code)
Inserts the given un-parented node as a sibling of this node, immediately before this node.
Parameters:
  sibling - the new sibling node
exception:
  DOMException - if any of the following conditions hold:
  • this node is a document fragment root
  • the sibling is not of the correct type
  • the sibling already has a parent
  • this sibling is an ancestor of this node

exception:
  IllegalArgumentException - if the sibling is null
See Also:   IDOMNode.addChild(IDOMNode)
See Also:   IDOMNode.clone()
See Also:   IDOMNode.remove()



isAllowableChild
public boolean isAllowableChild(IDOMNode node)(Code)
Returns whether the given node is an allowable child for this node.
Parameters:
  node - the potential child node true if the given node is an allowable child



isSignatureEqual
public boolean isSignatureEqual(IDOMNode node)(Code)
Returns whether this node's signature is equivalent to the given node's signature. In other words, if the nodes were siblings, would the declarations collide because they represent the same declaration.
Parameters:
  node - the other node true if the nodes have equivalent signatures



remove
public void remove()(Code)
Separates this node from its parent and siblings, maintaining any ties that this node has to the underlying document fragment. A document fragment that is removed from its host document may still be dependent on that host document until it is inserted into a different document. Removing a root node has no effect.
See Also:   IDOMNode.addChild(IDOMNode)
See Also:   IDOMNode.clone()
See Also:   IDOMNode.insertSibling(IDOMNode)



setName
public void setName(String name)(Code)
Sets the name of this node. Name format depends on node type. More details are provided in each of the subtypes.
Parameters:
  name - the name, or null to clear the name



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.