|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.uni_paderborn.tools.util.MethodDeclaration
The class MethodDeclaration provides information about a String that declares a method. It tries to parse the provided parameter, that can be a UML-like or a Java-like declarationn (or both). This declaration is not quite the style for instance demanded by the Java Language Specification. But it should help to interpret the user's input as its best.
Field Summary | |
static java.lang.String |
EMPTY_DECLARATION
No comment provided by developer, please add a comment to improve documentation. |
static java.lang.String |
ILLEGAL_PARAMETER_AND_RETURN_TYPE_DECLARATION
No comment provided by developer, please add a comment to improve documentation. |
static java.lang.String |
ILLEGAL_PARAMETER_DECLARATION
No comment provided by developer, please add a comment to improve documentation. |
static java.lang.String |
ILLEGAL_RETURN_TYPE_DECLARATION
No comment provided by developer, please add a comment to improve documentation. |
static java.lang.String |
INVALID_METHOD_DECLARATION
No comment provided by developer, please add a comment to improve documentation. |
private boolean |
isAbstract
No comment provided by developer, please add a comment to improve documentation. |
private boolean |
isFinal
No comment provided by developer, please add a comment to improve documentation. |
private boolean |
isNative
No comment provided by developer, please add a comment to improve documentation. |
private boolean |
isPackage
No comment provided by developer, please add a comment to improve documentation. |
private boolean |
isParsed
No comment provided by developer, please add a comment to improve documentation. |
private boolean |
isPrivate
No comment provided by developer, please add a comment to improve documentation. |
private boolean |
isProtected
No comment provided by developer, please add a comment to improve documentation. |
private boolean |
isPublic
No comment provided by developer, please add a comment to improve documentation. |
private boolean |
isStatic
No comment provided by developer, please add a comment to improve documentation. |
private boolean |
isSynchronized
No comment provided by developer, please add a comment to improve documentation. |
private boolean |
isTransient
No comment provided by developer, please add a comment to improve documentation. |
private boolean |
isVolatile
No comment provided by developer, please add a comment to improve documentation. |
static java.lang.String |
METHOD_IS_KEYWORD
No comment provided by developer, please add a comment to improve documentation. |
private java.lang.String |
methodError
No comment provided by developer, please add a comment to improve documentation. |
private java.lang.String |
name
No comment provided by developer, please add a comment to improve documentation. |
static java.lang.String |
NO_METHOD_NAME_DECLARED
No comment provided by developer, please add a comment to improve documentation. |
private java.lang.String |
original
The originally provided String. |
private java.lang.String[] |
param
No comment provided by developer, please add a comment to improve documentation. |
private java.lang.String |
rType
No comment provided by developer, please add a comment to improve documentation. |
static java.lang.String |
VALID_DECLARATION
No comment provided by developer, please add a comment to improve documentation. |
private java.lang.String[] |
var
No comment provided by developer, please add a comment to improve documentation. |
Constructor Summary | |
MethodDeclaration(java.lang.String declaration)
Creates a new object fo MethodDeclaration and parses the provided String. |
Method Summary | |
java.lang.String |
getFullName()
Constructs the full method-name in fujaba-style, so it can be used for a call to UMLMethod#getFromMethods(String); The resulting string looks like: name(type1,type2,type3,...) |
java.lang.String |
getMethodError()
Returns the method error, that is an error occured while parsing. |
java.lang.String |
getName()
Returns the name of this Declaration. |
java.lang.String[] |
getParameters()
Returns the parameters of this Declaration as an array. |
java.lang.String[] |
getParameterVariables()
Returns the variable names of the parameters, in the same order as the parameters. |
java.lang.String |
getReturnType()
Returns the return type of this Declaration. |
java.lang.String |
getStatus()
Returns information about this declaration. |
int |
getVisibility()
Get the visibility attribute of the MethodDeclaration object |
boolean |
isAbstract()
Returns true if this Declaration is abstract, false otherwise. |
boolean |
isEmpty()
Returns true if this MethodDeclaration is empty. |
boolean |
isFinal()
Returns true if this Declaration is final, false otherwise. |
boolean |
isNative()
Returns true if this Declaration is native, false otherwise. |
boolean |
isPackage()
Returns true if this Declaration's visibility is package-wide, false otherwise. |
boolean |
isPrivate()
Returns true if this Declaration's visibility is private, false otherwise. |
boolean |
isProtected()
Returns true if this Declaration's visibility is protected, false otherwise. |
boolean |
isPublic()
Returns true if this Declaration's visibility is public, false otherwise. |
boolean |
isStatic()
Returns true if this Declaration is static, false otherwise. |
boolean |
isSynchronized()
Returns true if this Declaration is synchronized, false otherwise. |
boolean |
isTransient()
Returns true if this Declaration is transient, false otherwise. |
boolean |
isValid()
Returns true, if this declaration is valid, NOT considerung parameters or return type. |
boolean |
isVolatile()
Returns true if this Declaration is volatile, false otherwise. |
private void |
parse()
Calls parseJavaMethod() and parseUMLMethod() in this order. |
private void |
parseJavaMethod()
Tries to parse the declaration as a Java-like expression. |
private void |
parseJavaParam(java.lang.String str)
Parses the parameters of a java-like-declaration |
private void |
parseUMLMethod()
Tries to parse the declaration as an UML-like expression. |
private void |
parseUMLParam(java.lang.String str)
Parses the parameters of a UML-like-declaration. |
private boolean |
setSignifierMethod(java.lang.String str,
boolean adjustType)
Sets all the signifiers by examining the String str. |
void |
showStatus()
Shows the status provided by getStatus() in a JOptionPane. |
static java.lang.String |
userReadableSignature(UMLMethod method)
No comment provided by developer, please add a comment to improve documentation. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String VALID_DECLARATION
public static final java.lang.String EMPTY_DECLARATION
public static final java.lang.String INVALID_METHOD_DECLARATION
public static final java.lang.String NO_METHOD_NAME_DECLARED
public static final java.lang.String METHOD_IS_KEYWORD
public static final java.lang.String ILLEGAL_RETURN_TYPE_DECLARATION
public static final java.lang.String ILLEGAL_PARAMETER_DECLARATION
public static final java.lang.String ILLEGAL_PARAMETER_AND_RETURN_TYPE_DECLARATION
private java.lang.String original
private java.lang.String methodError
private boolean isParsed
private boolean isPublic
private boolean isPackage
private boolean isProtected
private boolean isPrivate
private boolean isFinal
private boolean isAbstract
private boolean isStatic
private boolean isSynchronized
private boolean isTransient
private boolean isVolatile
private boolean isNative
private java.lang.String name
private java.lang.String rType
private java.lang.String[] param
private java.lang.String[] var
Constructor Detail |
public MethodDeclaration(java.lang.String declaration)
declaration
- The String to be a method declaration.
NullPointerException,
- if declaration
is null.Method Detail |
private void parse()
private void parseJavaMethod()
Parameters have to be divided by komma, otherwise they won't be recognized. You can provide
different types only, or even a type with a variable.
DECLARATION
LITERAL EXAMPLE
method_name_only
doSomething
method_name parenthesis
doSomething ()
method_name parenthesis_with_parameter(s)
doSomething (int, String)
method_name parenthesis semicolon
doSomething ();
method_name parenthesis_with_parameter(s) semicolon
doSomething (int, String);
signifier(s) method_name
public (static ...) doSomething
method_name parenthesis semicolon
doSomething ();
method_name parenthesis_with_parameter(s) semicolon
doSomething (int, String);
signifier(s) method_name parenthesis semicolon
public (static ...) doSomething ();
signifier(s) method_name parenthesis_with_parameter(s) semicolon
public (static ...) doSomething (int, String);
return_type method_name
void doSomething
return_type method_name parenthesis
void doSomething ()
return_type method_name parenthesis_with_parameter(s)
void doSomething (int, String)
return_type method_name parenthesis semicolon
void doSomething ();
return_type method_name parenthesis_with_parameter(s) semicolon
void doSomething (int, String);
signifier(s) return_type method_name
public (static ...) void doSomething
signifier(s) return_type method_name parenthesis
public (static ...) void doSomething ()
signifier(s) return_type method_name parenthesis_with_parameter(s)
public (static ...) void doSomething (int, String)
signifier(s) return_type method_name parenthesis semicolon
public (static ...) void doSomething ();
signifier(s) return_type method_name parenthesis_with_parameter(s) semicolon
public (static ...) void doSomething (int, String);
When the method name is a Java keyword this declaration is invalid. Note:
Since you cannot define a package visible method explicitly (when making no specifications
like in Java itself, the visibility will be ignored here), here it is allowed to write
the keyword 'package' as visibility type.
private void parseUMLMethod()
DECLARATION
LITERAL EXAMPLE
method_name_only
doSomething
method_name return_type
doSomething : int
visibility method_name
+ doSomething
visibility method_name return_type
+ doSomething : int
method_name parenthesis
doSomething ()
method_name parenthesis return_type
doSomething () : int
method_name parenthesis parameter(s)
doSomething (int, String)
method_name parenthesis parameter(s) return_type
doSomething (int, String):int
visibility method_name parenthesis
+ doSomething ()
visibility method_name parenthesisb return_type
+ doSomething ():int
visibility method_name parenthesis parameter(s)
+ doSomething (int, String)
Parameters have to be divided by komma or semicolon, otherwise they won't be recognized.
You can provide different types only, or even a type with a variable.
visibility method_name parenthesis parameter(s) return_type
+ doSomething (int, String):int
When the method name is a Java keyword this declaration is invalid.
private void parseUMLParam(java.lang.String str)
str
- No description providedprivate void parseJavaParam(java.lang.String str)
str
- No description providedpublic java.lang.String getName()
public java.lang.String getFullName()
The resulting string looks like: name(type1,type2,type3,...) where type is a name without preceeding packagename e.g. parseJavaParam(String)
public java.lang.String getReturnType()
public java.lang.String[] getParameters()
public java.lang.String[] getParameterVariables()
public java.lang.String getStatus()
public void showStatus()
public java.lang.String getMethodError()
public int getVisibility()
public boolean isPublic()
public boolean isPackage()
public boolean isProtected()
public boolean isPrivate()
public boolean isFinal()
public boolean isAbstract()
public boolean isStatic()
public boolean isSynchronized()
public boolean isTransient()
public boolean isVolatile()
public boolean isNative()
public boolean isEmpty()
private boolean setSignifierMethod(java.lang.String str, boolean adjustType)
str
- The new signifierMethod valueadjustType
- The new signifierMethod value
public boolean isValid()
public static java.lang.String userReadableSignature(UMLMethod method)
method
- No description provided
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |