Eclipse JDT
2.1

org.eclipse.jdt.core.jdom
Class DOMFactory

java.lang.Object
  |
  +--org.eclipse.jdt.core.jdom.DOMFactory
All Implemented Interfaces:
IDOMFactory

public class DOMFactory
extends Object
implements IDOMFactory

Standard implementation of IDOMFactory, and the only means of creating JDOMs and document fragments.

This class may be instantiated; it is not intended to be subclassed.


Constructor Summary
DOMFactory()
          Creates a new DOM factory.
 
Method Summary
 IDOMType createClass()
          Creates a default type document fragment.
 IDOMCompilationUnit createCompilationUnit()
          Creates and return an empty JDOM.
 IDOMCompilationUnit createCompilationUnit(char[] sourceCode, String name)
          Creates a JDOM on the given source code.
 IDOMCompilationUnit createCompilationUnit(String sourceCode, String name)
          Creates a JDOM on the given source code.
 IDOMField createField()
          Creates a default field document fragment.
 IDOMField createField(String sourceCode)
          Creates a field document fragment on the given source code.
 IDOMImport createImport()
          Creates an empty import document fragment.
 IDOMImport createImport(String sourceCode)
          Creates an import document fragment on the given source code.
 IDOMInitializer createInitializer()
          Creates an empty initializer document fragment.
 IDOMInitializer createInitializer(String sourceCode)
          Creates an initializer document fragment from the given source code.
 IDOMType createInterface()
          Creates a default type document fragment.
 IDOMMethod createMethod()
          Creates a default method document fragment.
 IDOMMethod createMethod(String sourceCode)
          Creates a method document fragment on the given source code.
 IDOMPackage createPackage()
          Creates an empty package document fragment.
 IDOMPackage createPackage(String sourceCode)
          Creates a package document fragment on the given source code.
 IDOMType createType()
          Creates a default type document fragment.
 IDOMType createType(String sourceCode)
          Creates a type document fragment on the given source code.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DOMFactory

public DOMFactory()
Creates a new DOM factory.
Method Detail

createCompilationUnit

public IDOMCompilationUnit createCompilationUnit()
Description copied from interface: IDOMFactory
Creates and return an empty JDOM. The initial content is an empty string.
Specified by:
createCompilationUnit in interface IDOMFactory
Following copied from interface: org.eclipse.jdt.core.jdom.IDOMFactory
Returns:
the new compilation unit

createCompilationUnit

public IDOMCompilationUnit createCompilationUnit(char[] sourceCode,
                                                 String name)
Description copied from interface: IDOMFactory
Creates a JDOM on the given source code. The syntax for the given source code corresponds to CompilationUnit (JLS2 7.3).
Specified by:
createCompilationUnit in interface IDOMFactory
Following copied from interface: org.eclipse.jdt.core.jdom.IDOMFactory
Parameters:
sourceCode - the source code character array, or null
name - the name of the compilation unit
Returns:
the new compilation unit, or null if unable to recognize the source code, or if the source code is null

createCompilationUnit

public IDOMCompilationUnit createCompilationUnit(String sourceCode,
                                                 String name)
Description copied from interface: IDOMFactory
Creates a JDOM on the given source code. The syntax for the given source code corresponds to CompilationUnit (JLS2 7.3).
Specified by:
createCompilationUnit in interface IDOMFactory
Following copied from interface: org.eclipse.jdt.core.jdom.IDOMFactory
Parameters:
sourceCode - the source code string, or null
name - the name of the compilation unit
Returns:
the new compilation unit, or null if unable to recognize the source code, or if the source code is null

createField

public IDOMField createField()
Description copied from interface: IDOMFactory
Creates a default field document fragment. Initially the field will have default protection, type "Object", name "aField", no comment, and no initializer.
Specified by:
createField in interface IDOMFactory
Following copied from interface: org.eclipse.jdt.core.jdom.IDOMFactory
Returns:
the new field

createField

public IDOMField createField(String sourceCode)
Description copied from interface: IDOMFactory
Creates a field document fragment on the given source code. The given source string corresponds to FieldDeclaration (JLS2 8.3) and ConstantDeclaration (JLS2 9.3) restricted to a single VariableDeclarator clause.
Specified by:
createField in interface IDOMFactory
Following copied from interface: org.eclipse.jdt.core.jdom.IDOMFactory
Parameters:
sourceCode - the source code
Returns:
the new field, or null if unable to recognize the source code, if the source code is null, or when the source contains more than one VariableDeclarator clause

createImport

public IDOMImport createImport()
Description copied from interface: IDOMFactory
Creates an empty import document fragment. Initially the import will have name "java.lang.*".
Specified by:
createImport in interface IDOMFactory
Following copied from interface: org.eclipse.jdt.core.jdom.IDOMFactory
Returns:
the new import

createImport

public IDOMImport createImport(String sourceCode)
Description copied from interface: IDOMFactory
Creates an import document fragment on the given source code. The syntax for the given source string corresponds to ImportDeclaration (JLS2 7.5).
Specified by:
createImport in interface IDOMFactory
Following copied from interface: org.eclipse.jdt.core.jdom.IDOMFactory
Parameters:
sourceCode - the source code
Returns:
the new import, or null if unable to recognize the source code, or if the source code is null

createInitializer

public IDOMInitializer createInitializer()
Description copied from interface: IDOMFactory
Creates an empty initializer document fragment. Initially the initializer will be static and have no body or comment.
Specified by:
createInitializer in interface IDOMFactory
Following copied from interface: org.eclipse.jdt.core.jdom.IDOMFactory
Returns:
the new initializer

createInitializer

public IDOMInitializer createInitializer(String sourceCode)
Description copied from interface: IDOMFactory
Creates an initializer document fragment from the given source code. The syntax for the given source string corresponds to InstanceInitializer (JLS2 8.6) and StaticDeclaration (JLS2 8.7).
Specified by:
createInitializer in interface IDOMFactory
Following copied from interface: org.eclipse.jdt.core.jdom.IDOMFactory
Parameters:
sourceCode - the source code
Returns:
the new initializer, or null if unable to recognize the source code, or if the source code is null

createMethod

public IDOMMethod createMethod()
Description copied from interface: IDOMFactory
Creates a default method document fragment. Initially the method will have public visibility, return type "void", be named "newMethod", have no parameters, no comment, and an empty body.
Specified by:
createMethod in interface IDOMFactory
Following copied from interface: org.eclipse.jdt.core.jdom.IDOMFactory
Returns:
the new method

createMethod

public IDOMMethod createMethod(String sourceCode)
Description copied from interface: IDOMFactory
Creates a method document fragment on the given source code. The syntax for the given source string corresponds to MethodDeclaration (JLS2 8.4), ConstructorDeclaration (JLS2 8.8), and AbstractMethodDeclaration (JLS2 9.4).
Specified by:
createMethod in interface IDOMFactory
Following copied from interface: org.eclipse.jdt.core.jdom.IDOMFactory
Parameters:
sourceCode - the source code
Returns:
the new method, or null if unable to recognize the source code, or if the source code is null

createPackage

public IDOMPackage createPackage()
Description copied from interface: IDOMFactory
Creates an empty package document fragment. Initially the package declaration will have no name.
Specified by:
createPackage in interface IDOMFactory
Following copied from interface: org.eclipse.jdt.core.jdom.IDOMFactory
Returns:
the new package

createPackage

public IDOMPackage createPackage(String sourceCode)
Description copied from interface: IDOMFactory
Creates a package document fragment on the given source code. The syntax for the given source string corresponds to PackageDeclaration (JLS2 7.4).
Specified by:
createPackage in interface IDOMFactory
Following copied from interface: org.eclipse.jdt.core.jdom.IDOMFactory
Parameters:
sourceCode - the source code
Returns:
the new package, or null if unable to recognize the source code, or if the source code is null

createType

public IDOMType createType()
Description copied from interface: IDOMFactory
Creates a default type document fragment. Initially the type will be a public class named "AClass", with no members or comment.
Specified by:
createType in interface IDOMFactory
Following copied from interface: org.eclipse.jdt.core.jdom.IDOMFactory
Returns:
the new type

createClass

public IDOMType createClass()
Description copied from interface: IDOMFactory
Creates a default type document fragment. Initially the type will be a public class named "AClass", with no members or comment.
Specified by:
createClass in interface IDOMFactory
Following copied from interface: org.eclipse.jdt.core.jdom.IDOMFactory
Returns:
the new class

createInterface

public IDOMType createInterface()
Description copied from interface: IDOMFactory
Creates a default type document fragment. Initially the type will be a public interface named "AnInterface", with no members or comment.
Specified by:
createInterface in interface IDOMFactory
Following copied from interface: org.eclipse.jdt.core.jdom.IDOMFactory
Returns:
the new interface

createType

public IDOMType createType(String sourceCode)
Description copied from interface: IDOMFactory
Creates a type document fragment on the given source code. The syntax for the given source string corresponds to ClassDeclaration (JLS2 8.1) and InterfaceDeclaration (JLS2 9.1).
Specified by:
createType in interface IDOMFactory
Following copied from interface: org.eclipse.jdt.core.jdom.IDOMFactory
Parameters:
sourceCode - the source code
Returns:
the new type, or null if unable to recognize the source code, or if the source code is null

Eclipse JDT
2.1

Copyright (c) IBM Corp. and others 2000, 2003. All Rights Reserved.