com.octagroup.foregej.java.util
Class BeansUtil

java.lang.Object
  |
  +--com.octagroup.foregej.java.util.BeansUtil

public class BeansUtil
extends java.lang.Object

Class that contains functionality associated with the beans specification.


Constructor Summary
BeansUtil()
           
 
Method Summary
static java.lang.String getPropertyName(AST_METHOD_DEF method)
          Returns the property name of the supplied method.
static java.lang.String getPropertyName(java.lang.String methodName)
          Returns the property name of the supplied method name.
static AST_TYPE getPropertyType(AST_METHOD_DEF method)
          Returns the type of property that this method accepts or returns.
static java.lang.String getSetterArgumentName(AST_METHOD_DEF setter)
          Returns the name of the argument for the setter method.
static AST_METHOD_DEF getter2Setter(AST_METHOD_DEF getter)
          Performs a deep copy of the getter and converts it to a setter.
static boolean isGetter(AST_METHOD_DEF method)
          Returns true if the suplied method is a getter method.
static boolean isGetter(java.lang.String methodName)
          Returns true if the suplied name is a getter method.
static boolean isGetterOrSetter(AST_METHOD_DEF method)
          Returns true if the method is a getter or setter.
static boolean isGetterOrSetter(java.lang.String methodName)
          Returns true if the method name is a getter or setter.
static boolean isSetter(AST_METHOD_DEF method)
          Returns true if the suplied method is a setter method.
static boolean isSetter(java.lang.String methodName)
          Returns true if the suplied name is a setter method.
static java.lang.String property2Method(java.lang.String property)
          Converts a property name to a method name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeansUtil

public BeansUtil()
Method Detail

getPropertyName

public static java.lang.String getPropertyName(AST_METHOD_DEF method)
Returns the property name of the supplied method.

This method extracts the name of the method and returns the property name for that. First it checks if it is a getter / setter.

Parameters:
method - the method name to determine the property name from.
Returns:
the property name of the supplied method name.

getPropertyName

public static java.lang.String getPropertyName(java.lang.String methodName)
Returns the property name of the supplied method name.

This method

Parameters:
methodName - the method name to determine the property name from.
Returns:
the property name of the supplied method name.

getter2Setter

public static AST_METHOD_DEF getter2Setter(AST_METHOD_DEF getter)
Performs a deep copy of the getter and converts it to a setter.

Since we perform a deep copy the body of the getter will also be copied.

Parameters:
getter -  
Returns:
 

isGetterOrSetter

public static boolean isGetterOrSetter(AST_METHOD_DEF method)
Returns true if the method is a getter or setter.
Parameters:
method - the method to switch on.
Returns:
true if the method is a getter or setter.

isGetterOrSetter

public static boolean isGetterOrSetter(java.lang.String methodName)
Returns true if the method name is a getter or setter.
Parameters:
methodName - the method name to switch on.
Returns:
true if the method name is a getter or setter.

isGetter

public static boolean isGetter(AST_METHOD_DEF method)
Returns true if the suplied method is a getter method.
Parameters:
method - the method
Returns:
true if the suplied method is a getter method.

isGetter

public static boolean isGetter(java.lang.String methodName)
Returns true if the suplied name is a getter method.
Parameters:
methodName - the name of the method
Returns:
true if the suplied name is a getter method.

isSetter

public static boolean isSetter(AST_METHOD_DEF method)
Returns true if the suplied method is a setter method.
Parameters:
method - the method
Returns:
true if the suplied method is a setter method.

isSetter

public static boolean isSetter(java.lang.String methodName)
Returns true if the suplied name is a setter method.
Parameters:
methodName - the name of the method
Returns:
true if the suplied name is a setter method.

property2Method

public static java.lang.String property2Method(java.lang.String property)
Converts a property name to a method name.

Usually this involves converting the first character to upper case.

Parameters:
property -  
Returns:
 

getPropertyType

public static AST_TYPE getPropertyType(AST_METHOD_DEF method)
Returns the type of property that this method accepts or returns.

The type is determined from the return value if this is a getter and from the argument if this is a setter.

Parameters:
method -  
Returns:
 

getSetterArgumentName

public static java.lang.String getSetterArgumentName(AST_METHOD_DEF setter)
Returns the name of the argument for the setter method.
Parameters:
setter - the method to get the setter argument from.
Returns:
the name of the argument for the setter method.


Copyright © 2003 El Icognito des Noboby. All Rights Reserved.