|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectarchimate.codegen.JavaHelper
public class JavaHelper
This utility class provides methods for accessing and editing source code
parsed by the ASTParser
Field Summary | |
---|---|
static java.lang.String |
ARCHIMATETAG
TagName for the archiMateTag |
static java.lang.String |
METHOD_DECLARATION
Constant defining a method declaration in an interface |
static java.lang.String |
METHOD_IMPLEMENTATION
Constant defining a method implementation in a class |
static java.lang.String |
METHOD_INVOCATION
Constant defining a method invocation in a class |
Constructor Summary | |
---|---|
JavaHelper(java.lang.String currentPattern)
Creates a new JavaHelper |
Method Summary | |
---|---|
void |
addClass(org.eclipse.jdt.core.dom.CompilationUnit unit,
JavaClass javaClass)
Adds a class declaration to the CompilationUnit . |
void |
addImports(org.eclipse.jdt.core.dom.CompilationUnit unit,
java.util.ArrayList<java.lang.String> imports)
Adds the given imports to the given CompilationUnit if it doesn't
already contain them. |
void |
addJavaDoc(org.eclipse.jdt.core.dom.BodyDeclaration body,
ICodeElement element)
Adds JavaDoc to a BodyDeclaration based on the settings of the
ICodeElement |
void |
addMethod(org.eclipse.jdt.core.dom.TypeDeclaration node,
JavaMethod method)
Adds a method to a TypeDeclaration based on the settings of the
JavaMethod . |
void |
addMethodInvocation(org.eclipse.jdt.core.dom.Block methodBlock,
java.lang.String objectName,
java.lang.String methodName,
java.util.ArrayList<java.lang.String> arglist)
Adds a method invocation to the method block |
void |
addMethods(org.eclipse.jdt.core.dom.TypeDeclaration node,
TagNode tagnode,
org.eclipse.core.runtime.MultiStatus status)
Adds methods defined by the TagNode s ICodeElement s to the
TypeDeclaration node |
void |
addObject(org.eclipse.jdt.core.dom.Block methodBlock,
java.lang.String type,
java.lang.String name,
java.util.ArrayList<java.lang.String> arglist)
Adds a statement that creates an object. |
static java.lang.String |
camelize(java.lang.String name)
Camelizes a name |
void |
compare(org.eclipse.jdt.core.dom.MethodDeclaration node,
TagNode tagnode,
org.eclipse.core.runtime.MultiStatus status,
java.lang.String pattern)
Compares the TagNode s source elements with the given
MethodDeclaration and sets the MultiStatus according to
the result |
void |
compare(org.eclipse.jdt.core.dom.TypeDeclaration node,
TagNode tagnode,
org.eclipse.core.runtime.MultiStatus status,
java.lang.String pattern)
Compares the TagNode s source elements with the given
TypeDeclaration and sets the MultiStatus according to the
result |
java.lang.String |
getArchiMateTag(org.eclipse.jdt.core.dom.BodyDeclaration node)
Searches for an archiMateTag in the javadoc of the given node. |
java.lang.String |
getName(org.eclipse.jdt.core.dom.MethodDeclaration node)
Returns the name of the MethodDeclaration |
java.lang.String |
getName(org.eclipse.jdt.core.dom.TypeDeclaration node)
Returns the name of the TypeDeclaration |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String ARCHIMATETAG
public static final java.lang.String METHOD_IMPLEMENTATION
public static final java.lang.String METHOD_INVOCATION
public static final java.lang.String METHOD_DECLARATION
Constructor Detail |
---|
public JavaHelper(java.lang.String currentPattern)
JavaHelper
currentPattern
- the pattern currently processedMethod Detail |
---|
public java.lang.String getArchiMateTag(org.eclipse.jdt.core.dom.BodyDeclaration node)
node
- ASTNode
to be searched
public java.lang.String getName(org.eclipse.jdt.core.dom.TypeDeclaration node)
TypeDeclaration
node
- a TypeDeclaration
TypeDeclaration
public java.lang.String getName(org.eclipse.jdt.core.dom.MethodDeclaration node)
MethodDeclaration
node
- a MethodDeclaration
MethodDeclaration
public void addImports(org.eclipse.jdt.core.dom.CompilationUnit unit, java.util.ArrayList<java.lang.String> imports)
CompilationUnit
if it doesn't
already contain them.
unit
- The CompilationUnit
to add the imports to.imports
- A list of import names to be addedpublic void addClass(org.eclipse.jdt.core.dom.CompilationUnit unit, JavaClass javaClass)
CompilationUnit
.
unit
- The CompilationUnit
to add the class declaration tojavaClass
- The JavaClass
defining the class to createpublic void addMethods(org.eclipse.jdt.core.dom.TypeDeclaration node, TagNode tagnode, org.eclipse.core.runtime.MultiStatus status)
TagNode
s ICodeElement
s to the
TypeDeclaration
node
node
- TypeDeclaration
node to add the methods totagnode
- TagNode
with a list of ICodeElement
spublic void addMethod(org.eclipse.jdt.core.dom.TypeDeclaration node, JavaMethod method)
TypeDeclaration
based on the settings of the
JavaMethod
. If the JavaMethod
s type is a
JavaMethod.DECLARATION
, a method declaration is added. If the
JavaMethod
s type is a JavaMethod.IMPLEMENTATION
, a method
with a method block is added. If the JavaMethod
s type is a
JavaMethod.INVOCATION
, a method with a method invocation in its
block is added.
node
- TypeDeclaration
node to add the methods tomethod
- JavaMethod
object containing all the settings for the
new methodpublic void addJavaDoc(org.eclipse.jdt.core.dom.BodyDeclaration body, ICodeElement element)
BodyDeclaration
based on the settings of the
ICodeElement
body
- the BodyDeclaration
to add the JavaDoc toelement
- the ICodeElement
to derive the documentation frompublic void addObject(org.eclipse.jdt.core.dom.Block methodBlock, java.lang.String type, java.lang.String name, java.util.ArrayList<java.lang.String> arglist)
Object
object = new Object(params)
public void addMethodInvocation(org.eclipse.jdt.core.dom.Block methodBlock, java.lang.String objectName, java.lang.String methodName, java.util.ArrayList<java.lang.String> arglist)
methodBlock
- The Block
to add the invocation toobjectName
- The name of the object on which to invoke the methodmethodName
- The name of the method to invokearglist
- The list of arguments for the method callpublic static java.lang.String camelize(java.lang.String name)
name
- The name to camelize
public void compare(org.eclipse.jdt.core.dom.TypeDeclaration node, TagNode tagnode, org.eclipse.core.runtime.MultiStatus status, java.lang.String pattern)
TagNode
s source elements with the given
TypeDeclaration
and sets the MultiStatus
according to the
result
node
- the TypeDeclaration
to compare withtagnode
- the given TagNode
status
- the MultiStatus
to setpattern
- the currently processed patternpublic void compare(org.eclipse.jdt.core.dom.MethodDeclaration node, TagNode tagnode, org.eclipse.core.runtime.MultiStatus status, java.lang.String pattern)
TagNode
s source elements with the given
MethodDeclaration
and sets the MultiStatus
according to
the result
node
- the MethodDeclaration
to compare withtagnode
- the given TagNode
status
- the MultiStatus
to setpattern
- the currently processed pattern
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |