ConForM.CoopnTools.JavaProto
Class ProtoClassFile

java.lang.Object
  |
  +--ConForM.CoopnTools.JavaProto.ProtoClass
        |
        +--ConForM.CoopnTools.JavaProto.ProtoClassFile
Direct Known Subclasses:
CBIExceptionProto, CGMExceptionProto, CMNFExceptionProto, CUSExceptionProto, ProtoClassCoopn

public class ProtoClassFile
extends ConForM.CoopnTools.JavaProto.ProtoClass

ProtoClassFile is a ProtoClass associated with a File. ProtoClassFile can save itself in file.


Constructor Summary
ProtoClassFile(JavaProtoEnv env)
          Creates a new ProtoClassFile
 
Method Summary
 void addExtend(java.lang.String extend)
          Adds an extends item (super class name)
 void addImplement(java.lang.String impl)
          Adds an implements item (implemented interface name)
 void addImport(java.lang.String imt)
          adds an import field to edited class
 void declareConstructor(java.lang.String constr)
          Adds a constructor
 void declareField(java.lang.String field)
          Adds a field (attribute) text
 void declareMethod(java.lang.String method)
          Adds a method
 void delete()
          Deletes java file of this class
 java.io.File getFile()
           
 java.lang.String getName()
          Returns the name of this class
 java.lang.String getPackage()
          gets package name of edited class
static java.io.File getPath(java.lang.String pckage, JavaProtoEnv env)
           
static java.io.File getPath(java.lang.String pckage, java.lang.String outdir)
           
protected  java.lang.String quote(java.lang.String arg)
          Helper method thet insertss a '\' before each special character.
 void save()
          Saves the text of composed class in a file.
 void setAttributes(java.lang.String atts)
          sets attributes of edited class
 void setInterface()
          sets edited class is an interface
 void setName(java.lang.String name)
          sets name of edited class
 void setPackage(java.lang.String pck)
          sets package name of edited class
 java.lang.String toString()
          Returns the text of composed class as a String
 void write(java.io.Writer w)
          Writes the text of composed class to a Writer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProtoClassFile

public ProtoClassFile(JavaProtoEnv env)
Creates a new ProtoClassFile
Parameters:
out - a file on which this ProtoClassFile can be saved.
Method Detail

getFile

public java.io.File getFile()

getPath

public static java.io.File getPath(java.lang.String pckage,
                                   java.lang.String outdir)

getPath

public static java.io.File getPath(java.lang.String pckage,
                                   JavaProtoEnv env)

save

public void save()
          throws java.io.IOException
Saves the text of composed class in a file.

delete

public void delete()
Deletes java file of this class

setPackage

public void setPackage(java.lang.String pck)
sets package name of edited class
Parameters:
pck - package name, exemple "java.lang"

getPackage

public java.lang.String getPackage()
gets package name of edited class

addImport

public void addImport(java.lang.String imt)
adds an import field to edited class
Parameters:
imt - import field, exemple "java.io.*"

setAttributes

public void setAttributes(java.lang.String atts)
sets attributes of edited class
Parameters:
atts - attributes, exemple "public abstract"

setInterface

public void setInterface()
sets edited class is an interface

setName

public void setName(java.lang.String name)
sets name of edited class
Parameters:
name - name of edited class, exemple "String"

getName

public java.lang.String getName()
Returns the name of this class

addExtend

public void addExtend(java.lang.String extend)
Adds an extends item (super class name)
Parameters:
extend - an extend, exemple "Object"

addImplement

public void addImplement(java.lang.String impl)
Adds an implements item (implemented interface name)
Parameters:
impl - an implements, exemple "Serializable"

declareField

public void declareField(java.lang.String field)
Adds a field (attribute) text
Parameters:
field - a field, exemple "private int size;"

declareMethod

public void declareMethod(java.lang.String method)
Adds a method
Parameters:
method - method text, exemple "int size(){return size;}"

declareConstructor

public void declareConstructor(java.lang.String constr)
Adds a constructor
Parameters:
constr - constructor text, exemple "public String(){super();}"

write

public void write(java.io.Writer w)
           throws java.io.IOException
Writes the text of composed class to a Writer
Parameters:
w - Writer

toString

public java.lang.String toString()
Returns the text of composed class as a String
Overrides:
toString in class java.lang.Object

quote

protected java.lang.String quote(java.lang.String arg)
Helper method thet insertss a '\' before each special character. Actually we consider as special only '\' ans '"' characters.