org.jtool.jxplatform.j2x
Class Binder

java.lang.Object
  extended byorg.jtool.jxplatform.j2x.Binder

public class Binder
extends java.lang.Object

Binds all references across different source files according to Eclipse's binding information.

Author:
Katsuhisa Maruyama

Constructor Summary
Binder()
          Creates a binder which adds binding information to an XML documents.
 
Method Summary
 void bind(org.w3c.dom.Document document)
          Adds binding information to an XML document.
 void close()
          Closes the binder.
static org.w3c.dom.Element getClassElement(org.w3c.dom.Element felem, java.lang.String fqn)
          Returns the element for a referenced class with a fully-qualified name.
static JxCompilationUnit getCompilationUnit0(java.lang.String projectname, java.lang.String pathname)
          Returns a compilation unit referencing a file with a name within a project.
static org.w3c.dom.Element getFieldElementById(org.w3c.dom.Element celem, java.lang.String defid)
          Returns the element for a referenced field having an id string.
static org.w3c.dom.Element getFieldElementByName(org.w3c.dom.Element celem, java.lang.String name)
          Returns the element for a referenced field having a name.convert
 java.util.HashMap getFqnElementMap()
          Obtains a map storing pairs of fully-qualified name and its DOM element.
static org.w3c.dom.Element getMethodElementById(org.w3c.dom.Element celem, java.lang.String defid)
          Returns the element for a referenced method or constructor having an id string.
static org.w3c.dom.Element getMethodElementBySignature(org.w3c.dom.Element celem, java.lang.String sig)
          Returns the element for a referenced method or constrcutor having a signature.
static java.lang.String getPathName(org.w3c.dom.Element elem)
          Returns the pathname of a class indicated by an element.
static java.lang.String getProjectName(org.w3c.dom.Element elem)
          Returns the project name of a class indicated by an element.
 boolean getResolveBindings()
          Tests if the converter adds binding information.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Binder

public Binder()
Creates a binder which adds binding information to an XML documents.

Method Detail

close

public void close()
Closes the binder.


getResolveBindings

public boolean getResolveBindings()
Tests if the converter adds binding information.

Returns:
true if bindings are wanted, or false if bindings are not of interest.

bind

public void bind(org.w3c.dom.Document document)
          throws JxException
Adds binding information to an XML document.

Parameters:
document - A DOM document object which binding infomation is added to.
Returns:
true if the binding succeeds, otherwise false.
Throws:
JxException - a fatal error occurred during the binding.

getProjectName

public static java.lang.String getProjectName(org.w3c.dom.Element elem)
Returns the project name of a class indicated by an element.

Parameters:
elem - A ClassLoc element.
Returns:
The project name string.

getPathName

public static java.lang.String getPathName(org.w3c.dom.Element elem)
Returns the pathname of a class indicated by an element.

Parameters:
elem - A ClassLoc element.
Returns:
The path name string.

getCompilationUnit0

public static JxCompilationUnit getCompilationUnit0(java.lang.String projectname,
                                                    java.lang.String pathname)
Returns a compilation unit referencing a file with a name within a project.

Parameters:
projectname - The project name of a file to be retrieved.
pathname - The path name of a file to be retrieved.
Returns:
The referencing compilation unit, or null if there is no compilation unit found.

getFqnElementMap

public java.util.HashMap getFqnElementMap()
Obtains a map storing pairs of fully-qualified name and its DOM element.

Returns:
The stored map.

getClassElement

public static org.w3c.dom.Element getClassElement(org.w3c.dom.Element felem,
                                                  java.lang.String fqn)
Returns the element for a referenced class with a fully-qualified name.

Parameters:
felem - A DOM element corresponding to a referencing file.
fqn - The fully qualified name of a class to be retrieved.
Returns:
The element for the matched class element, or null if there is no element found.

getMethodElementById

public static org.w3c.dom.Element getMethodElementById(org.w3c.dom.Element celem,
                                                       java.lang.String defid)
Returns the element for a referenced method or constructor having an id string.

Parameters:
celem - A DOM element corresponding a referenced class.
defid - The id string of a method to be retrieved.
Returns:
The element for the matched method, or null if there is no element found.

getMethodElementBySignature

public static org.w3c.dom.Element getMethodElementBySignature(org.w3c.dom.Element celem,
                                                              java.lang.String sig)
Returns the element for a referenced method or constrcutor having a signature.

Parameters:
celem - A DOM element corresponding a referenced class.
sig - The signature of a method to be retrieved.
Returns:
The element for the matched method, or null if there is no element found.

getFieldElementById

public static org.w3c.dom.Element getFieldElementById(org.w3c.dom.Element celem,
                                                      java.lang.String defid)
Returns the element for a referenced field having an id string.

Parameters:
celem - A DOM element corresponding a referenced class.
defid - The id string of a field to be retrieved.
Returns:
The element for the matched field, or null if there is no element found.

getFieldElementByName

public static org.w3c.dom.Element getFieldElementByName(org.w3c.dom.Element celem,
                                                        java.lang.String name)
Returns the element for a referenced field having a name.convert

Parameters:
celem - A DOM element corresponding a referenced class.
name - The name of a field to be retrieved.
Returns:
The element for the matched field, or null if there is no element found.