org.acmsl.contractchecker
Class ContractCheckerUtils

java.lang.Object
  |
  +--org.acmsl.contractchecker.ContractCheckerUtils

public abstract class ContractCheckerUtils
extends java.lang.Object

Provides some general-purpose methods needed by ContractChecker.

Version:
$Revision: 1.3 $
Author:
Jose San Leandro Armend?riz

Field Summary
static org.apache.tools.ant.types.FileSet[] EMPTY_FILESET_ARRAY
          Empty fileset array.
 
Constructor Summary
protected ContractCheckerUtils()
          Protected constructor to avoid accidental instantiation.
 
Method Summary
static ContractCheckerUtils getInstance()
          Retrieves a ContractCheckerUtils instance.
protected static java.lang.ref.WeakReference getReference()
          Retrieves the weak reference.
 java.lang.String packageToFilePath(java.lang.String packageName)
          Translates given package name to a relative file path.
 java.lang.String removeExceptions(java.lang.String methodSignature)
          Removes the exception declaration from given method signature.
 java.lang.String removeReturn(java.lang.String methodSignature)
          Removes the return declaration from given method signature.
 java.io.File retrieveAspectFolder(java.io.File parentFolder, java.lang.String packageName)
          Retrieves the folder for the aspects associated to given package.
 java.lang.String retrieveAspectPackage(java.lang.String packageName)
          Retrieves the package name of the aspects associated to given package.
protected static void setReference(ContractCheckerUtils utils)
          Specifies a new weak reference.
 org.apache.tools.ant.types.FileSet toFileSet(java.lang.String location, org.apache.tools.ant.Project project)
          BUilds a FileSet for given location.
 org.apache.tools.ant.types.FileSet[] toFileSets(org.apache.tools.ant.types.Path path)
          Translates given path to a collection of filesets.
 void writeFile(java.io.File file, java.lang.String contents)
          Writes a file with given contents.
 void writeFile(java.lang.String filePath, java.lang.String contents)
          Writes a file referred by given path, with given contents.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_FILESET_ARRAY

public static final org.apache.tools.ant.types.FileSet[] EMPTY_FILESET_ARRAY
Empty fileset array.

Constructor Detail

ContractCheckerUtils

protected ContractCheckerUtils()
Protected constructor to avoid accidental instantiation.

Method Detail

setReference

protected static void setReference(ContractCheckerUtils utils)
Specifies a new weak reference.

Parameters:
utils - the utils instance to use.

getReference

protected static java.lang.ref.WeakReference getReference()
Retrieves the weak reference.

Returns:
such reference.

getInstance

public static ContractCheckerUtils getInstance()
Retrieves a ContractCheckerUtils instance.

Returns:
such instance.

writeFile

public void writeFile(java.lang.String filePath,
                      java.lang.String contents)
               throws java.io.FileNotFoundException,
                      java.lang.SecurityException,
                      java.io.IOException
Writes a file referred by given path, with given contents.

Parameters:
filePath - the path of the file.
contents - the text to write.
Throws:
java.io.FileNotFoundException - if the file is not found.
java.lang.SecurityException - if the security manager forbids this operation.
java.io.IOException - if any other I/O error occurs.

writeFile

public void writeFile(java.io.File file,
                      java.lang.String contents)
               throws java.io.FileNotFoundException,
                      java.lang.SecurityException,
                      java.io.IOException
Writes a file with given contents.

Parameters:
file - the file to write.
contents - the text to write.
Throws:
java.io.FileNotFoundException - if the file is not found.
java.lang.SecurityException - if the security manager forbids this operation.
java.io.IOException - if any other I/O error occurs.

retrieveAspectPackage

public java.lang.String retrieveAspectPackage(java.lang.String packageName)
Retrieves the package name of the aspects associated to given package.

Parameters:
packageName - the original package.
Returns:
the package for the associated aspects.

retrieveAspectFolder

public java.io.File retrieveAspectFolder(java.io.File parentFolder,
                                         java.lang.String packageName)
Retrieves the folder for the aspects associated to given package.

Parameters:
parentFolder - the parent folder.
packageName - the original package.
Returns:
the folder in which the associated aspects should be generated.

packageToFilePath

public java.lang.String packageToFilePath(java.lang.String packageName)
Translates given package name to a relative file path.

Parameters:
packageName - the pacjage name.
Returns:
such path

removeExceptions

public java.lang.String removeExceptions(java.lang.String methodSignature)
Removes the exception declaration from given method signature.

Parameters:
methodSignature - the method signature.
Returns:
the updated signature.

removeReturn

public java.lang.String removeReturn(java.lang.String methodSignature)
Removes the return declaration from given method signature.

Parameters:
methodSignature - the method signature.
Returns:
the updated signature.

toFileSets

public org.apache.tools.ant.types.FileSet[] toFileSets(org.apache.tools.ant.types.Path path)
Translates given path to a collection of filesets.

Parameters:
path - the path to translate.
Returns:
the filesets.

toFileSet

public org.apache.tools.ant.types.FileSet toFileSet(java.lang.String location,
                                                    org.apache.tools.ant.Project project)
BUilds a FileSet for given location.

Parameters:
location - the location.
project - the project.
Returns:
the fileset.


Copyright © 2003-2004 ACM S.L.. All Rights Reserved.