org.gmetrics.source
Class SourceFile

java.lang.Object
  extended by org.gmetrics.source.AbstractSourceCode
      extended by org.gmetrics.source.SourceFile
All Implemented Interfaces:
groovy.lang.GroovyObject, SourceCode

public class SourceFile
extends AbstractSourceCode
implements groovy.lang.GroovyObject

The SourceCode implementation for a single file. Note that the path is normalized: file separator chars are normalized to standard '/'.

Version:
$Revision: 29 $ - $Date: 2009-12-13 15:50:29 -0500 (Sun, 13 Dec 2009) $
Author:
Chris Mair

Constructor Summary
SourceFile(java.io.File file)
          Construct a new instance for the file at the specified path
 
Method Summary
protected  java.lang.Object createSourceUnit()
           
 groovy.lang.MetaClass getMetaClass()
           
 java.lang.String getName()
          Get the logical name for this source code.
 java.lang.String getPath()
          Get the logical path for this source code.
 java.lang.Object getProperty(java.lang.String name)
           
 java.lang.String getText()
           
 java.lang.Object invokeMethod(java.lang.String name, java.lang.Object args)
           
 void setMetaClass(groovy.lang.MetaClass metaClass)
           
 void setProperty(java.lang.String name, java.lang.Object value)
           
 java.lang.String toString()
           
 
Methods inherited from class org.gmetrics.source.AbstractSourceCode
getAst, getFILE_SEPARATOR, getLineNumberForCharacterIndex, getLines, getLOG, line, normalizePath
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SourceFile

public SourceFile(java.io.File file)
Construct a new instance for the file at the specified path

Parameters:
path - - the path of the file; must not be null or empty
Method Detail

getName

public java.lang.String getName()
Description copied from interface: SourceCode
Get the logical name for this source code. If this object is a file, then the name is the filename, without a path.

Specified by:
getName in interface SourceCode
Returns:
the filename for this source file, excluding path

getPath

public java.lang.String getPath()
Description copied from interface: SourceCode
Get the logical path for this source code. If this object is a file, then the name is the full path in the filesystem. File separators are normalized to forward slash (/).

Specified by:
getPath in interface SourceCode
Returns:
the normalized path for this source file, including filename

getText

public java.lang.String getText()
Specified by:
getText in interface SourceCode
Returns:
the full text of the source code

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

createSourceUnit

protected java.lang.Object createSourceUnit()
Specified by:
createSourceUnit in class AbstractSourceCode

getMetaClass

public groovy.lang.MetaClass getMetaClass()
Specified by:
getMetaClass in interface groovy.lang.GroovyObject
Overrides:
getMetaClass in class AbstractSourceCode

setMetaClass

public void setMetaClass(groovy.lang.MetaClass metaClass)
Specified by:
setMetaClass in interface groovy.lang.GroovyObject
Overrides:
setMetaClass in class AbstractSourceCode

invokeMethod

public java.lang.Object invokeMethod(java.lang.String name,
                                     java.lang.Object args)
Specified by:
invokeMethod in interface groovy.lang.GroovyObject
Overrides:
invokeMethod in class AbstractSourceCode

getProperty

public java.lang.Object getProperty(java.lang.String name)
Specified by:
getProperty in interface groovy.lang.GroovyObject
Overrides:
getProperty in class AbstractSourceCode

setProperty

public void setProperty(java.lang.String name,
                        java.lang.Object value)
Specified by:
setProperty in interface groovy.lang.GroovyObject
Overrides:
setProperty in class AbstractSourceCode


Copyright © 2010. All Rights Reserved.