de.uni_paderborn.tools.util
Class ClassDeclaration

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

public class ClassDeclaration
extends java.lang.Object

The class ClassDeclaration provides information about a String that declares a class. It tries to parse the provided parameter, that has to be a fujaba-like declaration (see below).

Version:
$Revision: 1.11 $
Author:
$Author: schneider $

Field Summary
static java.lang.String CLASS_IS_KEYWORD
          No comment provided by developer, please add a comment to improve documentation.
private  java.lang.String classError
          No comment provided by developer, please add a comment to improve documentation.
private  java.util.HashSet constructors
          No comment provided by developer, please add a comment to improve documentation.
static java.lang.String EMPTY_DECLARATION
          No comment provided by developer, please add a comment to improve documentation.
static java.lang.String ILLEGAL_CONSTRUCTORS_DECLARATION
          No comment provided by developer, please add a comment to improve documentation.
static java.lang.String INVALID_CLASS_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 isInterface
          No comment provided by developer, please add a comment to improve documentation.
private  boolean isPersistent
          No comment provided by developer, please add a comment to improve documentation.
private  boolean isReference
          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  java.lang.String name
          No comment provided by developer, please add a comment to improve documentation.
static java.lang.String NO_CONSTRUCTORS_ALLOWED
          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 packageName
          No comment provided by developer, please add a comment to improve documentation.
private  int paramcount
          No comment provided by developer, please add a comment to improve documentation.
static java.lang.String UNPRECISE_CONSTRUCTORS_DECLARATION
          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
ClassDeclaration(java.lang.String declaration)
          Creates a new object of ClassDeclareation and parses the provided String.
 
Method Summary
 void clear()
          No comment provided by developer, please add a comment to improve documentation.
 java.lang.String getClassError()
          Returns the method error, that is an error occured while parsing.
 java.util.HashSet getConstructors()
          Returns all defined constructors in a HashSet.
 java.lang.String getName()
          Returns the name of this Declaration.
 java.lang.String getPackage()
          Get the package attribute of the ClassDeclaration object
 java.lang.String getStatus()
          Returns information about this declaration.
 boolean isAbstract()
          Returns true if this Declaration is abstract, false otherwise.
 boolean isEmpty()
          Returns true if this ClassDeclaration is empty.
 boolean isInterface()
          Get the interface attribute of the ClassDeclaration object
 boolean isPersistent()
          Get the persistent attribute of the ClassDeclaration object
 boolean isReference()
          Get the reference attribute of the ClassDeclaration object
 boolean isStatic()
          Returns true if this Declaration is static, false otherwise.
 boolean isValid()
          Returns true, if this declaration is valid, NOT considerung parameters or return type.
private  void parse()
          Tries to parse the provided String as a new class.
private  int parseParam(java.lang.String str)
          Parses the parameters
private  boolean putToConstructors(java.lang.String string)
          Parses the provided String to be a constructor-definition.
 void showStatus()
          Shows the status provided by getStatus() in a JOptionPane.
 
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_CLASS_DECLARATION

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

See Also:
Constant Field Values

CLASS_IS_KEYWORD

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

See Also:
Constant Field Values

ILLEGAL_CONSTRUCTORS_DECLARATION

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

See Also:
Constant Field Values

NO_CONSTRUCTORS_ALLOWED

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

See Also:
Constant Field Values

UNPRECISE_CONSTRUCTORS_DECLARATION

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

See Also:
Constant Field Values

original

private java.lang.String original
The originally provided String.


classError

private java.lang.String classError
No comment provided by developer, please add a comment to improve documentation.


isAbstract

private boolean isAbstract
No comment provided by developer, please add a comment to improve documentation.


isStatic

private boolean isStatic
No comment provided by developer, please add a comment to improve documentation.


isInterface

private boolean isInterface
No comment provided by developer, please add a comment to improve documentation.


isPersistent

private boolean isPersistent
No comment provided by developer, please add a comment to improve documentation.


isReference

private boolean isReference
No comment provided by developer, please add a comment to improve documentation.


name

private java.lang.String name
No comment provided by developer, please add a comment to improve documentation.


packageName

private java.lang.String packageName
No comment provided by developer, please add a comment to improve documentation.


constructors

private java.util.HashSet constructors
No comment provided by developer, please add a comment to improve documentation.


paramcount

private int paramcount
No comment provided by developer, please add a comment to improve documentation.

Constructor Detail

ClassDeclaration

public ClassDeclaration(java.lang.String declaration)
Creates a new object of ClassDeclareation and parses the provided String.

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

parse

private void parse()
Tries to parse the provided String as a new class. Constructors can also be establieshed. Here is a list of possible examples, how to declare a new class: DECLARATION LITERAL EXAMPLE class_name_only Class full_qualified_class_name java.lang.Class signifier(s) class_name abstract Class   abstract reference static Class signifier(s) full_qualified_class_name abstract java.lang.Class

Any of the ones above can be followed by parenthesis representing the parameters of the (only then) created constructor(s). The 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.
When the class name is a Java keyword this declaration is invalid. Parameter types and theri representing variables can be divided by white-space (then the declaration has to be java-like, e. g. String s, int i), or it has to be divided by colon (then the declaration has to be uml-like, e. g. s:String, i:int).


parseParam

private int parseParam(java.lang.String str)
Parses the parameters

Parameters:
str - No description provided
Returns:
No description provided

putToConstructors

private boolean putToConstructors(java.lang.String string)
Parses the provided String to be a constructor-definition.

Parameters:
string - No description provided
Returns:
No description provided

getConstructors

public java.util.HashSet getConstructors()
Returns all defined constructors in a HashSet. Each entry of this set contains a vector, each vector represents one constructor and contains its parameters. Each odd cell of the vector contains therefor the type of the parameter, e. g. String or Integer, each even cell represents the variable-bname to its predecessor

Returns:
The constructors value

getName

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

Returns:
The name value

getStatus

public java.lang.String getStatus()
Returns information about this declaration. These information contain:
  • the name of the Declaration
  • the type of the Declaration
  • the visibility of this Declaration (if defined)
  • the constructors (if defined)
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.


getClassError

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

Returns:
The classError 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

isInterface

public boolean isInterface()
Get the interface attribute of the ClassDeclaration object

Returns:
The interface value

isPersistent

public boolean isPersistent()
Get the persistent attribute of the ClassDeclaration object

Returns:
The persistent value

isReference

public boolean isReference()
Get the reference attribute of the ClassDeclaration object

Returns:
The reference value

isEmpty

public boolean isEmpty()
Returns true if this ClassDeclaration 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

getPackage

public java.lang.String getPackage()
Get the package attribute of the ClassDeclaration object

Returns:
The package value

clear

public void clear()
No comment provided by developer, please add a comment to improve documentation.