|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.argouml.uml.reveng.java.Modeller
Modeller maps Java source code(parsed/recognised by ANTLR) to UML model elements, it applies some of the semantics in JSR26.
Field Summary | |
private boolean |
arraysAsDatatype
Arrays will be modelled as unique datatypes. |
private Hashtable |
attributes
Arbitrary attributes. |
private Object |
currentPackage
The package which the currentClassifier belongs to. |
private String |
currentPackageName
Last package name used in addPackage(). |
private DiagramInterface |
diagram
|
private String |
fileName
The name of the file being parsed. |
private Import |
importSession
Current import session. |
private static Logger |
LOG
Logger. |
private Object |
model
Current working model. |
private boolean |
noAssociations
Only attributes will be generated. |
private ParseState |
parseState
Keeps the data that varies during parsing. |
private Stack |
parseStateStack
Stack up the state when descending inner classes. |
Constructor Summary | |
Modeller(Object m,
DiagramInterface diag,
Import imp,
boolean noAss,
boolean arraysAsDT,
String fName)
Create a new modeller. |
Method Summary | |
void |
addAnonymousClass(String type)
Called from the parser when an anonymous inner class is found. |
void |
addAttribute(short modifiers,
String typeSpec,
String name,
String initializer,
String javadoc)
Called from the parser when an attribute is found. |
void |
addBodyToOperation(Object op,
String body)
Called from the parser to add a method body to an operation. |
void |
addCall(String method,
String obj)
This method currently does nothing. |
void |
addClass(String name,
short modifiers,
String superclassName,
Vector interfaces,
String javadoc)
Called from the parser when a class declaration is found. |
private Object |
addClassifier(Object newClassifier,
String name,
short modifiers,
String javadoc)
Common code used by addClass and addInterface. |
void |
addComponent()
This is a mapping from a Java compilation Unit -> a UML component. |
private void |
addDocumentationTag(Object modelElement,
String sJavaDocs)
Add the javadocs as a tagged value 'documentation' to the model element. |
void |
addImport(String name)
Called from the parser when an import clause is found. |
void |
addInterface(String name,
short modifiers,
Vector interfaces,
String javadoc)
Called from the parser when an interface declaration is found. |
private void |
addJavadocTagContents(Object me,
String sTagName,
String sTagData)
Add the contents of a single standard javadoc tag to the model element. |
Object |
addOperation(short modifiers,
String returnType,
String name,
Vector parameters,
String javadoc)
Called from the parser when an operation is found. |
void |
addPackage(String name)
Called from the parser when a package clause is found. |
private void |
cleanModelElement(Object element)
This classifier was earlier generated by reference but now it is its time to be parsed so we clean out remnants. |
private Object |
getAbstraction(Object parent,
Object child)
Find an abstraction< |
private Object |
getAssociationEnd(String name,
Object mClassifier)
Find an associationEnd from the currentClassifier to the type specified. |
Object |
getAttribute(String key)
|
private Object |
getAttribute(String name,
String initializer,
Object mClassifier)
Find an attribute in the currentClassifier. |
private String |
getClassifierName(String name)
Get the classifier name from a fully specified classifier name. |
private Context |
getContext(String name)
Get the context for a classifier name that may or may not be fully qualified. |
private DiagramInterface |
getDiagram()
Get the current diagram. |
private Object |
getGeneralization(Object mPackage,
Object parent,
Object child)
Find a generalization in the model. |
private Object |
getMethod(String name)
Find an operation in the currentClassifier. |
private Object |
getOperation(String name)
Find an operation in the currentClassifier. |
private Object |
getPackage(String name)
Find a package in the model. |
private String |
getPackageName(String name)
Get the package name from a fully specified classifier name. |
private String |
getRelativePackageName(String packageName)
Get the relative package name from a fully qualified package name. |
private Object |
getStereotype(Object me,
String name,
String baseClass)
Find the first suitable stereotype with baseclass for a given object. |
private Object |
getStereotype(String name)
Get the stereotype with a specific name. |
private Object |
getTaggedValue(Object element,
String name)
Return the tagged value with a specific tag. |
void |
popClassifier()
Called from the parser when a classifier is completely parsed. |
private Object |
searchPackageInModel(String name)
Search recursivly for nested packages in the model. |
void |
setAttribute(String key,
Object value)
|
private void |
setOwnerScope(Object feature,
short modifiers)
Set the owner scope for a feature. |
private void |
setTargetScope(Object mAssociationEnd,
short modifiers)
Set the target scope for an association end. |
private void |
setVisibility(Object element,
short modifiers)
Set the visibility for a model element. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final Logger LOG
private Object model
private DiagramInterface diagram
private Import importSession
private Object currentPackage
private String currentPackageName
private ParseState parseState
private Stack parseStateStack
private boolean noAssociations
private boolean arraysAsDatatype
private String fileName
private Hashtable attributes
Constructor Detail |
public Modeller(Object m, DiagramInterface diag, Import imp, boolean noAss, boolean arraysAsDT, String fName)
diag
- the interface to the diagram to add nodes and edges toimp
- The current Import session.noAss
- whether associations are modelled as attributesarraysAsDT
- whether darrays are modelled as dataypesfName
- the current file namem
- The model to work with.Method Detail |
public Object getAttribute(String key)
key
- the key of the attribute to get
public void setAttribute(String key, Object value)
key
- the key of the attributevalue
- the value for the attributeprivate DiagramInterface getDiagram()
public void addComponent()
See JSR 26.
Adding components is a little messy since there are 2 cases:
In either case we need to add a package since we don't know in advance if there will be a package statement.
public void addPackage(String name)
name
- The name of the package.public void addImport(String name)
name
- The name of the import. Can end with a '*'.public void addClass(String name, short modifiers, String superclassName, Vector interfaces, String javadoc)
name
- The name of the class.modifiers
- A sequence of class modifiers.superclassName
- Zero or one string with the name of the
superclass. Can be fully qualified or
just a simple class name.interfaces
- Zero or more strings with the names of implemented
interfaces. Can be fully qualified or just a
simple interface name.javadoc
- The javadoc comment. null or "" if no comment available.public void addAnonymousClass(String type)
type
- The type of this anonymous class.public void addInterface(String name, short modifiers, Vector interfaces, String javadoc)
name
- The name of the interface.modifiers
- A sequence of interface modifiers.interfaces
- Zero or more strings with the names of extended
interfaces. Can be fully qualified or just a
simple interface name.javadoc
- The javadoc comment. "" if no comment available.private Object addClassifier(Object newClassifier, String name, short modifiers, String javadoc)
newClassifier
- Supply one if none is found in the model.name
- Name of the classifier.modifiers
- String of modifiers.javadoc
- The javadoc comment. null or "" if no comment available.
public void popClassifier()
public Object addOperation(short modifiers, String returnType, String name, Vector parameters, String javadoc)
modifiers
- A sequence of operation modifiers.returnType
- The return type of the operation.name
- The name of the operation as a stringparameters
- A number of vectors, each representing a
parameter.javadoc
- The javadoc comment. null or "" if no comment available.
public void addBodyToOperation(Object op, String body)
op
- An operation.body
- A method body.public void addAttribute(short modifiers, String typeSpec, String name, String initializer, String javadoc)
modifiers
- A sequence of attribute modifiers.typeSpec
- The attribute's type.name
- The name of the attribute.initializer
- The initial value of the attribute.javadoc
- The javadoc comment. null or "" if no comment available.private Object getGeneralization(Object mPackage, Object parent, Object child)
mPackage
- Look in this package.parent
- The superclass.child
- The subclass.
private Object getAbstraction(Object parent, Object child)
parent
- The superclass.child
- The subclass.
private Object getPackage(String name)
name
- The name of the package.
private Object searchPackageInModel(String name)
name
- The fully qualified package name of the package we
are searching for.
private Object getOperation(String name)
name
- The name of the operation.
private Object getMethod(String name)
name
- The name of the method.
private Object getAttribute(String name, String initializer, Object mClassifier)
name
- The name of the attribute.initializer
- The initializer code.mClassifier
- The type, used when checking for existing
association.
private Object getAssociationEnd(String name, Object mClassifier)
name
- The name of the attribute.mClassifier
- Where the association ends.
private Object getStereotype(String name)
name
- The name of the stereotype.
private Object getStereotype(Object me, String name, String baseClass)
me
- name
- baseClass
-
IllegalArgumentException
- if the desired stereotypes for
the modelelement and baseclass was not found. No stereotype is
created.private Object getTaggedValue(Object element, String name)
element
- The tagged value belongs to this.name
- The tag.
private void cleanModelElement(Object element)
element
- that they are removed fromprivate String getPackageName(String name)
name
- A fully specified classifier name.
private String getRelativePackageName(String packageName)
packageName
- A fully qualified package name.
private String getClassifierName(String name)
name
- A fully specified classifier name.
private void setVisibility(Object element, short modifiers)
element
- The model element.modifiers
- A sequence of modifiers which may contain
'private', 'protected' or 'public'.private void setOwnerScope(Object feature, short modifiers)
feature
- The feature.modifiers
- A sequence of modifiers which may contain
'static'.private void setTargetScope(Object mAssociationEnd, short modifiers)
mAssociationEnd
- The end.modifiers
- A sequence of modifiers which may contain
'static'.private Context getContext(String name)
name
- The classifier name.private void addJavadocTagContents(Object me, String sTagName, String sTagData)
addDocumentationTag(java.lang.Object, java.lang.String)
only.
me
- the model element to add tosTagName
- the name of the javadoc tagsTagData
- the contents of the javadoc tagprivate void addDocumentationTag(Object modelElement, String sJavaDocs)
modelElement
- the model element to which to add the documentationsJavaDocs
- the documentation comment to add ("" or null
if no java docs)public void addCall(String method, String obj)
Once we start reverse engineering interactions, this is used.
method
- The method name called.obj
- The object it is called in.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ArgoUML © 1996-2004 (20050222) | ArgoUML Homepage | ArgoUML Developers' page | ArgoUML Cookbook |