org.jtool.jxplatform.query
Class QueryProject

java.lang.Object
  extended byorg.jtool.jxplatform.query.QueryProject

public class QueryProject
extends java.lang.Object

A utility class which provides quaries about projects. Do not pass null to any parameter in methods in this class.

Author:
katsuhisa Maruayma

Constructor Summary
QueryProject()
           
 
Method Summary
protected static java.util.ArrayList getAccessesUsingField(JxElement jelem, JxField jfield)
          Obtains all field access wrappers in a given DOM subtree which access a given field.
static JxClassList getAllJxClasses(JxProject project)
          Obtains all classes which exist in a given project.
static JxFileList getAllJxFiles(JxProject project)
          Obtains all files which exist in a given project.
static java.util.ArrayList getAllPackageNames(JxProject project)
          Obtains all packages which exist in a given project.
static JxClassList getAnonymousJavaClasses(JxProject project, JxClass jclass)
          Obtains all wrappers of anonymous classes in a given project that are equal to a given class.
protected static java.util.ArrayList getCallsUsingMethod(JxElement jelem, JxMethod jmethod)
          Obtains all method call wrappers in a given DOM subtree which call a given method.
static JxClassList getClassesCallingMethod(JxProject project, JxMethod jmethod)
          Obtains all classes in a given project that call a given method.
static JxClassList getClassesInPackage(JxProject project, java.lang.String pname)
          Obtains all classes which exist in a given package of a given project.
static JxClass getClassInProject(JxProject project, java.lang.String fqn)
          Returns a class with a given name in a given project.
static JxFileList getFilesCallingMethod(JxProject project, JxMethod jmethod)
          Obtains all files in a given project that call a given method.
static JxFileList getFilesCallingTheMethodExceptSelf(JxProject project, JxMethod jmethod)
          Obtains all files in a given project that call a given method except the method itself.
static JxFileList getFilesInPackage(JxProject project, java.lang.String pname)
          Obtains all files which exist in a given package of a given project.
static JxFileList getFilesUsingClass(JxProject project, JxClass jclass)
          Obtains all files in a given project that use a given class.
static JxFileList getFilesUsingClassExceptSelf(JxProject project, JxClass jclass)
          Obtains all files in a given project that use a given class except the class itself.
static JxFileList getFilesUsingField(JxProject project, JxField jfield)
          Obtains all files in a given project that access a given field.
static JxFileList getFilesUsingFieldExceptSelf(JxProject project, JxField jfield)
          Obtains all files in a given project that access a given field except the fiels itself.
static JxFile getFileWithName(JxProject project, java.lang.String name)
          Returns a file with a given name in a given project.
static JxClassList getJxClassesUsingTheField(JxProject project, JxField jfield)
          Obtains all classes in a given project that access a given field.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryProject

public QueryProject()
Method Detail

getAllPackageNames

public static java.util.ArrayList getAllPackageNames(JxProject project)
                                              throws JxUnknownResultException
Obtains all packages which exist in a given project.

Parameters:
project - A project.
Returns:
The collection of names of the packages in the project.
Throws:
JxUnknownResultException - if the result is unknown.

getAllJxFiles

public static JxFileList getAllJxFiles(JxProject project)
                                throws JxUnknownResultException
Obtains all files which exist in a given project.

Parameters:
project - A project.
Returns:
The collection of the files in the project.
Throws:
JxUnknownResultException - if the result is unknown.

getFilesInPackage

public static JxFileList getFilesInPackage(JxProject project,
                                           java.lang.String pname)
                                    throws JxUnknownResultException
Obtains all files which exist in a given package of a given project.

Parameters:
project - A project.
pname - A package name.
Returns:
The collection of files in the package.
Throws:
JxUnknownResultException - if the result is unknown.

getFileWithName

public static JxFile getFileWithName(JxProject project,
                                     java.lang.String name)
                              throws JxUnknownResultException
Returns a file with a given name in a given project.

Parameters:
project - A project.
name - The path name of a file.
Returns:
The detected file, or null if there is no file detected.
Throws:
JxUnknownResultException - if the result is unknown.

getAllJxClasses

public static JxClassList getAllJxClasses(JxProject project)
                                   throws JxUnknownResultException
Obtains all classes which exist in a given project.

Parameters:
project - A project.
Returns:
The collection of classes in the project.
Throws:
JxUnknownResultException - if the result is unknown.

getClassesInPackage

public static JxClassList getClassesInPackage(JxProject project,
                                              java.lang.String pname)
                                       throws JxUnknownResultException
Obtains all classes which exist in a given package of a given project.

Parameters:
project - A project.
pname - A package name.
Returns:
The collection of classes in the package.
Throws:
JxUnknownResultException - if the result is unknown.

getFilesUsingClass

public static JxFileList getFilesUsingClass(JxProject project,
                                            JxClass jclass)
                                     throws JxUnknownResultException
Obtains all files in a given project that use a given class.

Parameters:
project - A project.
jclass - A class wrapper.
Returns:
The collection of files using the class.
Throws:
JxUnknownResultException - if the result is unknown.

getFilesUsingClassExceptSelf

public static JxFileList getFilesUsingClassExceptSelf(JxProject project,
                                                      JxClass jclass)
                                               throws JxUnknownResultException
Obtains all files in a given project that use a given class except the class itself.

Parameters:
project - A project.
jclass - A class wrapper.
Returns:
The collection of files using the class.
Throws:
JxUnknownResultException - if the result is unknown.

getFilesCallingMethod

public static JxFileList getFilesCallingMethod(JxProject project,
                                               JxMethod jmethod)
                                        throws JxUnknownResultException
Obtains all files in a given project that call a given method.

Parameters:
project - A project.
jmethod - A method wrapper.
Returns:
The collection of files calling the method.
Throws:
JxUnknownResultException - if the result is unknown.

getFilesCallingTheMethodExceptSelf

public static JxFileList getFilesCallingTheMethodExceptSelf(JxProject project,
                                                            JxMethod jmethod)
                                                     throws JxUnknownResultException
Obtains all files in a given project that call a given method except the method itself.

Parameters:
project - A project.
jmethod - A method wrapper.
Returns:
The collection of files calling the method.
Throws:
JxUnknownResultException - if the result is unknown.

getFilesUsingField

public static JxFileList getFilesUsingField(JxProject project,
                                            JxField jfield)
                                     throws JxUnknownResultException
Obtains all files in a given project that access a given field.

Parameters:
project - A project.
jfield - A field wrapper.
Returns:
The collection of files accessing the field.
Throws:
JxUnknownResultException - if the result is unknown.

getFilesUsingFieldExceptSelf

public static JxFileList getFilesUsingFieldExceptSelf(JxProject project,
                                                      JxField jfield)
                                               throws JxUnknownResultException
Obtains all files in a given project that access a given field except the fiels itself.

Parameters:
project - A project.
jfield - A field wrapper.
Returns:
The collection of files accessing the field.
Throws:
JxUnknownResultException - if the result is unknown.

getCallsUsingMethod

protected static java.util.ArrayList getCallsUsingMethod(JxElement jelem,
                                                         JxMethod jmethod)
                                                  throws JxUnknownResultException
Obtains all method call wrappers in a given DOM subtree which call a given method.

Parameters:
jelem - The root element of a DOM subtree.
jmethod - A method wrapper.
Returns:
The collection of JxMethodCall objects.
Throws:
JxUnknownResultException - if the result is unknown.

getAccessesUsingField

protected static java.util.ArrayList getAccessesUsingField(JxElement jelem,
                                                           JxField jfield)
                                                    throws JxUnknownResultException
Obtains all field access wrappers in a given DOM subtree which access a given field.

Parameters:
jelem - The root element of a DOM subtree.
jfield - A field wrapper.
Returns:
The collection of JxFieldAccess objects.
Throws:
JxUnknownResultException - if the result is unknown.

getClassesCallingMethod

public static JxClassList getClassesCallingMethod(JxProject project,
                                                  JxMethod jmethod)
                                           throws JxUnknownResultException
Obtains all classes in a given project that call a given method.

Parameters:
project - A project.
jmethod - A method wrapper.
Returns:
The collection of classes calling the method.
Throws:
JxUnknownResultException - if the result is unknown.

getJxClassesUsingTheField

public static JxClassList getJxClassesUsingTheField(JxProject project,
                                                    JxField jfield)
                                             throws JxUnknownResultException
Obtains all classes in a given project that access a given field.

Parameters:
project - A project.
jfield - A field wrapper.
Returns:
The collection of classes accessing the field.
Throws:
JxUnknownResultException - if the result is unknown.

getAnonymousJavaClasses

public static JxClassList getAnonymousJavaClasses(JxProject project,
                                                  JxClass jclass)
                                           throws JxUnknownResultException
Obtains all wrappers of anonymous classes in a given project that are equal to a given class.

Parameters:
project - A project.
jclass - A class wrapper.
Returns:
The collection of the anonymous classes.
Throws:
JxUnknownResultException - if the result is unknown.

getClassInProject

public static JxClass getClassInProject(JxProject project,
                                        java.lang.String fqn)
                                 throws JxUnknownResultException
Returns a class with a given name in a given project.

Parameters:
project - A project.
fqn - A fully qualified name of a class.
Returns:
The class wrapper, null if no class was found.
Throws:
JxUnknownResultException - if the result is unknown.