de.uni_paderborn.tools.util
Class MethodDeclaration

java.lang.Object
  extended byde.uni_paderborn.tools.util.MethodDeclaration

public class MethodDeclaration
extends java.lang.Object

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.

Version:
$Revision: 1.16.2.1 $
Author:
$Author: fklar $

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.
static java.lang.String METHOD_IS_KEYWORD
          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.
static java.lang.String VALID_DECLARATION
          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.
 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

VALID_DECLARATION

public static final java.lang.String VALID_DECLARATION
No comment provided by developer, please add a comment to improve documentation.

See Also:
Constant Field Values

EMPTY_DECLARATION

public static final java.lang.String EMPTY_DECLARATION
No comment provided by developer, please add a comment to improve documentation.

See Also:
Constant Field Values

INVALID_METHOD_DECLARATION

public static final java.lang.String INVALID_METHOD_DECLARATION
No comment provided by developer, please add a comment to improve documentation.

See Also:
Constant Field Values

NO_METHOD_NAME_DECLARED

public static final java.lang.String NO_METHOD_NAME_DECLARED
No comment provided by developer, please add a comment to improve documentation.

See Also:
Constant Field Values

METHOD_IS_KEYWORD

public static final java.lang.String METHOD_IS_KEYWORD
No comment provided by developer, please add a comment to improve documentation.

See Also:
Constant Field Values

ILLEGAL_RETURN_TYPE_DECLARATION

public static final java.lang.String ILLEGAL_RETURN_TYPE_DECLARATION
No comment provided by developer, please add a comment to improve documentation.

See Also:
Constant Field Values

ILLEGAL_PARAMETER_DECLARATION

public static final java.lang.String ILLEGAL_PARAMETER_DECLARATION
No comment provided by developer, please add a comment to improve documentation.

See Also:
Constant Field Values

ILLEGAL_PARAMETER_AND_RETURN_TYPE_DECLARATION

public static final java.lang.String ILLEGAL_PARAMETER_AND_RETURN_TYPE_DECLARATION
No comment provided by developer, please add a comment to improve documentation.

See Also:
Constant Field Values
Constructor Detail

MethodDeclaration

public MethodDeclaration(java.lang.String declaration)
Creates a new object fo MethodDeclaration and parses the provided String.

Parameters:
declaration - The String to be a method declaration.
Throws:
NullPointerException, - if declaration is null.
Method Detail

getName

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

Returns:
The name value

getFullName

public 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,...)
 where type is a name without preceeding packagename
 e.g.
   parseJavaParam(String)
 

Returns:
The full method-name.

getReturnType

public java.lang.String getReturnType()
Returns the return type of this Declaration.
 NOTE: If no return type is defined, this MAY be a
 constructor-declaration. In this case, please check
 MethodDeclaration#getName() against
 the name of the class this method should be placed into.
 If they equal this declaration is a constructor.
 So you have to adjust the returned value to
 UMLBaseTypes.CONSTRUCTOR.
 

Returns:
The returnType value

getParameters

public java.lang.String[] getParameters()
Returns the parameters of this Declaration as an array. If there are no parameters, an array with length 0 will be returned.

Returns:
The parameters value

getParameterVariables

public java.lang.String[] getParameterVariables()
Returns the variable names of the parameters, in the same order as the parameters. If a parameter has no variable, an empty String is provided in this case. The returned array is exact as long as the array containing the parameters.

Returns:
The parameterVariables value

getStatus

public java.lang.String getStatus()
Returns information about this declaration. These information contain:
The String is formatted to be shown best with a JOptionPane. Use showStatus() to do this.

Returns:
The status value

showStatus

public void showStatus()
Shows the status provided by getStatus() in a JOptionPane.


getMethodError

public java.lang.String getMethodError()
Returns the method error, that is an error occured while parsing. If no error occured an appropriate message is returned.

Returns:
The methodError value

getVisibility

public int getVisibility()
Get the visibility attribute of the MethodDeclaration object

Returns:
The visibility value

isPublic

public boolean isPublic()
Returns true if this Declaration's visibility is public, false otherwise.

Returns:
The public value

isPackage

public boolean isPackage()
Returns true if this Declaration's visibility is package-wide, false otherwise.

Returns:
The package value

isProtected

public boolean isProtected()
Returns true if this Declaration's visibility is protected, false otherwise.

Returns:
The protected value

isPrivate

public boolean isPrivate()
Returns true if this Declaration's visibility is private, false otherwise.

Returns:
The private value

isFinal

public boolean isFinal()
Returns true if this Declaration is final, false otherwise.

Returns:
The final value

isAbstract

public boolean isAbstract()
Returns true if this Declaration is abstract, false otherwise.

Returns:
The abstract value

isStatic

public boolean isStatic()
Returns true if this Declaration is static, false otherwise.

Returns:
The static value

isSynchronized

public boolean isSynchronized()
Returns true if this Declaration is synchronized, false otherwise.

Returns:
The synchronized value

isTransient

public boolean isTransient()
Returns true if this Declaration is transient, false otherwise.

Returns:
The transient value

isVolatile

public boolean isVolatile()
Returns true if this Declaration is volatile, false otherwise.

Returns:
The volatile value

isNative

public boolean isNative()
Returns true if this Declaration is native, false otherwise.

Returns:
The native value

isEmpty

public boolean isEmpty()
Returns true if this MethodDeclaration is empty.

Returns:
The empty value

isValid

public boolean isValid()
Returns true, if this declaration is valid, NOT considerung parameters or return type. An empty declaration is not valid.

Returns:
The valid value

userReadableSignature

public static java.lang.String userReadableSignature(UMLMethod method)
No comment provided by developer, please add a comment to improve documentation.

Parameters:
method - No description provided
Returns:
No description provided