Jalopy 1.0b10

de.hunsicker.jalopy.language
Class MethodType

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

public class MethodType
extends Object
implements 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 $
Author:
Marco Hunsicker

Field Summary
static MethodType GETTER
          Represents a Java Bean accessor.
static MethodType OTHER
          Represents an ordinary Java method.
static MethodType SETTER
          Represents a Java Bean mutator.
static MethodType TESTER
          Represents a Java Bean accessor/tester.
 
Method Summary
 int compareTo(Object other)
          Compares this object with the specified object for order.
static String getOrder()
          Returns a string representation of the current sort order.
 boolean isBean()
          Indicates whether this type represents a Java Bean method.
static void setOrder(String str)
          Sets the order to use as the natural order.
 String toString()
          Returns a string representation of this method type.
static MethodType valueOf(String name)
          Returns the method type of the given method name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

GETTER

public static final MethodType GETTER
Represents a Java Bean accessor.

SETTER

public static final MethodType SETTER
Represents a Java Bean mutator.

TESTER

public static final MethodType TESTER
Represents a Java Bean accessor/tester.

OTHER

public static final MethodType OTHER
Represents an ordinary Java method.
Method Detail

setOrder

public static void setOrder(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 (e.g. isFoo,getFoo,setFoo,foo)
Throws:
IllegalArgumentException - if the given string is invalid.

getOrder

public static String getOrder()
Returns a string representation of the current sort order. To encode the different method types, the common foo abreviation is used:
      
isFoo,getFoo,setFoo,foo or foo,getFoo,isFoo,setFoo or ...
Returns:
a string representation of the current sort order.

compareTo

public int compareTo(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 Comparable
Parameters:
other - the object to be compared.
Returns:
DOCUMENT ME!
Throws:
ClassCastException - if the specified object's type prevents it from being compared to this object.

toString

public String toString()
Returns a string representation of this method type.
Overrides:
toString in class Object
Returns:
a string representation of this type.

valueOf

public static MethodType valueOf(String name)
Returns the method type of the given method name.
Parameters:
name - a method name.
Returns:
the method type of the given name.
Throws:
IllegalArgumentException - if no valid method name is given.

isBean

public boolean isBean()
Indicates whether this type represents a Java Bean method.
Returns:
true if this method type adheres to the Java Bean naming conventions.

Jalopy 1.0b10

Submit a bug or feature.

For further information and documentation, visit the official Jalopy website.
This page generated: November 14 2002