echoxul.util.bean
Class BeanConversion

java.lang.Object
  extended byechoxul.util.bean.BeanConversion

public class BeanConversion
extends java.lang.Object

This class abstracts the details of converting an XML style name to a Java identifier. Many times this will result in multiple possible permutations being possible for the same input. Therefore, the conversion methods all return String arrays with the possibilities.

Rules for class name conversion

In this XUL implementation, classnames are represented by XML element names. While there is nothing illegal about using a standard Java name as an XML name, the formatting will look strange. Therefore, if the XML name is a legal Java value, it will be returned unchanged in the permutation set. However, additional permutations will be generated depending on the format of the name.
These additional permutation rules are only triggered in the following instances: In these cases, the following rule will be applied: A permutation will be generated which has its first character converted to upper case and each character which follows a hyphen converted to uppercase and the hyphens removed.

Author:
Terry Laurenzo

Constructor Summary
BeanConversion()
           
 
Method Summary
static java.lang.String[] createNamePermutations(java.lang.String in)
           
static java.lang.Class lookupClass(java.lang.ClassLoader cl, java.lang.String nameSpace, java.lang.String xmlName)
           
static void setBeanProperty(java.lang.Object bean, java.lang.String name, java.lang.String value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanConversion

public BeanConversion()
Method Detail

lookupClass

public static java.lang.Class lookupClass(java.lang.ClassLoader cl,
                                          java.lang.String nameSpace,
                                          java.lang.String xmlName)
Parameters:
cl -
nameSpace -
xmlName -
Returns:
The resolved class or null if not found
Throws:
java.lang.Error - if the class was found but could not be initialized (propogates errors from Class.forName())

createNamePermutations

public static java.lang.String[] createNamePermutations(java.lang.String in)

setBeanProperty

public static void setBeanProperty(java.lang.Object bean,
                                   java.lang.String name,
                                   java.lang.String value)
                            throws java.lang.Exception
Parameters:
bean - The dynamic bean
name - The property name in "xml" notation
value - The value to set it to
Throws:
java.lang.Exception


Copyright © 2004 Terry Laurenzo. All Rights Reserved.