de.hunsicker.jalopy.language
Class DeclarationType

java.lang.Object
  |
  +--de.hunsicker.jalopy.language.DeclarationType
All Implemented Interfaces:
java.lang.Comparable, Type

public class DeclarationType
extends java.lang.Object
implements java.lang.Comparable, Type

Represents a method type to distinguish between ordinary method names and those which adhere to the Java Bean naming conventions.

The default order for comparing is: ordinary Java method names, mutator, accessor/tester. This can be changed via setOrder(java.lang.String).

Version:
$Revision: 1.2.2.2 $
Author:
Marco Hunsicker

Field Summary
static DeclarationType ANNOTATION
          Represents an ANNOTATION declaration.
static int ANNOTATION_INT
          The bit value for annotations.
static DeclarationType CLASS
          Represents a class declaration.
static int CLASS_INT
          The bit value for classes.
static DeclarationType CTOR
          Represents a constructor declaration.
static int CTOR_INT
          The bit value for constructors.
static DeclarationType ENUM
          Represents an ENUM declaration.
static int ENUM_INT
          The bit value for enums.
static DeclarationType INIT
          Represents an instance initializer.
static int INIT_INT
          The bit value for instance initializers.
static DeclarationType INTERFACE
          Represents an interface declaration.
static int INTERFACE_INT
          The bit value for interfaces.
static DeclarationType METHOD
          Represents a method declaration.
static int METHOD_INT
          The bit value for methods.
static int STATIC_VAR_INIT_INT
          The bit value for static variables/initializers.
static DeclarationType STATIC_VARIABLE_INIT
          Represents a static variable declaration or initializer.
static DeclarationType VARIABLE
          Represents an instance variable declaration.
static int VARIABLE_INT
          The bit value for instance variables.
 
Method Summary
 int compareTo(java.lang.Object other)
          Compares this object with the specified object for order.
 java.lang.String getDisplayName()
          Returns the display name
 int getKey()
          Returns the key
 java.lang.String getName()
          Returns the name of this type.
static java.lang.String getOrder()
          Returns a string representation of the current sort order.
static int getOrderSize()
           
static void setOrder(java.lang.String str)
          Sets the order to use as the natural order.
 java.lang.String toString()
          Returns a string representation of this method type.
static DeclarationType valueOf(java.lang.String name)
          Returns the declaration type of the given abreviation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CLASS_INT

public static final int CLASS_INT
The bit value for classes.

See Also:
Constant Field Values

CTOR_INT

public static final int CTOR_INT
The bit value for constructors.

See Also:
Constant Field Values

INIT_INT

public static final int INIT_INT
The bit value for instance initializers.

See Also:
Constant Field Values

INTERFACE_INT

public static final int INTERFACE_INT
The bit value for interfaces.

See Also:
Constant Field Values

METHOD_INT

public static final int METHOD_INT
The bit value for methods.

See Also:
Constant Field Values

ANNOTATION_INT

public static final int ANNOTATION_INT
The bit value for annotations.

See Also:
Constant Field Values

ENUM_INT

public static final int ENUM_INT
The bit value for enums.

See Also:
Constant Field Values

VARIABLE_INT

public static final int VARIABLE_INT
The bit value for instance variables.

See Also:
Constant Field Values

STATIC_VAR_INIT_INT

public static final int STATIC_VAR_INIT_INT
The bit value for static variables/initializers.

See Also:
Constant Field Values

CLASS

public static final DeclarationType CLASS
Represents a class declaration.


ANNOTATION

public static final DeclarationType ANNOTATION
Represents an ANNOTATION declaration.


ENUM

public static final DeclarationType ENUM
Represents an ENUM declaration.


INTERFACE

public static final DeclarationType INTERFACE
Represents an interface declaration.


VARIABLE

public static final DeclarationType VARIABLE
Represents an instance variable declaration.


INIT

public static final DeclarationType INIT
Represents an instance initializer.


CTOR

public static final DeclarationType CTOR
Represents a constructor declaration.


METHOD

public static final DeclarationType METHOD
Represents a method declaration.


STATIC_VARIABLE_INIT

public static final DeclarationType STATIC_VARIABLE_INIT
Represents a static variable declaration or initializer.

Method Detail

getName

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

Returns:
type name.

setOrder

public static void setOrder(java.lang.String str)
Sets the order to use as the natural order.

Parameters:
str - a string representing the new order. The string must consist of exactly four different, comma delimited strings which represents a method type.
Throws:
java.lang.IllegalArgumentException - if the given string is invalid.

getOrder

public static java.lang.String getOrder()
Returns a string representation of the current sort order. To encode the different declaration types, use
 Variable,Initializer,Constructor,Method,Interface,Class
 
or any combination thereof.

Returns:
the string representation of the order.

getOrderSize

public static int getOrderSize()

getDisplayName

public java.lang.String getDisplayName()
Returns the display name

Returns:
The display name

getKey

public int getKey()
Returns the key

Returns:
The key

compareTo

public int compareTo(java.lang.Object other)
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
other - the object to be compared.
Returns:
An integer comparision of the 2 values
Throws:
java.lang.ClassCastException - if the specified object's type prevents it from being compared to this object.

toString

public java.lang.String toString()
Returns a string representation of this method type.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of this type.

valueOf

public static DeclarationType valueOf(java.lang.String name)
Returns the declaration type of the given abreviation.

Parameters:
name - a declaration identifier.
Returns:
the declaration type of the given name.
Throws:
java.lang.IllegalArgumentException - if no valid declaration identifier was given.


Copyright © 1997-2005 Jalopy. All Rights Reserved.