org.argouml.language.java.generator
Class AttributeCodePiece

java.lang.Object
  extended byorg.argouml.language.java.generator.CodePiece
      extended byorg.argouml.language.java.generator.NamedCodePiece
          extended byorg.argouml.language.java.generator.AttributeCodePiece

public class AttributeCodePiece
extends NamedCodePiece

This code piece represents an attribute. Even though the code can handle several attributes in the same statement, the code generated will be separate statements and initialization code for all but the last will be removed. JavaRE - Code generation and reverse engineering for UML and Java


Field Summary
private  CompositeCodePiece attributeDef
          The code piece this attribute represents.
private  Vector attributeNames
          The names of declared attributes.
 
Constructor Summary
AttributeCodePiece(CodePiece modifiers, CodePiece type, Vector names)
          Constructor.
 
Method Summary
private  GeneratorJava generator()
          Get the generator.
 int getEndLine()
           
 int getEndPosition()
           
 int getStartLine()
           
 int getStartPosition()
           
 StringBuffer getText()
           
 void write(BufferedReader reader, BufferedWriter writer, Stack parseStateStack)
          Write the code this piece represents to file.
 
Methods inherited from class org.argouml.language.java.generator.NamedCodePiece
ffCodePiece
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

attributeDef

private CompositeCodePiece attributeDef
The code piece this attribute represents.


attributeNames

private Vector attributeNames
The names of declared attributes.

Constructor Detail

AttributeCodePiece

public AttributeCodePiece(CodePiece modifiers,
                          CodePiece type,
                          Vector names)
Constructor.

Parameters:
modifiers - The code piece for modifiers.
type - The code piece for the type.
names - Vector with attribute names.
Method Detail

getText

public StringBuffer getText()
Specified by:
getText in class CodePiece
Returns:
the string representation for this piece of code
See Also:
Return the string representation for this piece of code.

getStartPosition

public int getStartPosition()
Specified by:
getStartPosition in class CodePiece
Returns:
the start position
See Also:
Return the start position.

getEndPosition

public int getEndPosition()
Specified by:
getEndPosition in class CodePiece
Returns:
the end position
See Also:
Return the end position.

getStartLine

public int getStartLine()
Specified by:
getStartLine in class CodePiece
Returns:
the start line
See Also:
Return the start line

getEndLine

public int getEndLine()
Specified by:
getEndLine in class CodePiece
Returns:
the end line
See Also:
Return the end line

write

public void write(BufferedReader reader,
                  BufferedWriter writer,
                  Stack parseStateStack)
           throws IOException
Description copied from class: NamedCodePiece
Write the code this piece represents to file. The stack in the parameter list contains the parser state when traversing up and down in nested classes and interfaces. The code that is written is generated from the model, but if no appropriate model element exists, then the original code is written in order to maintain additionally source code.

Specified by:
write in class NamedCodePiece
Parameters:
reader - Read original code from this.
writer - Write code to this.
parseStateStack - Information with one stack frame for each classifier that the parser has descended into.
Throws:
IOException - if we cannot write to the writer or read from the reader.
See Also:
Write the code this piece represents to file. (Does not check for uniqueness of names.)

generator

private GeneratorJava generator()
Get the generator.

Returns:
the generator.


ArgoUML © 1996-2004 (20050222)ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook