echoxul.util.bean
Class BeanConversion
java.lang.Object
echoxul.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:
- The name does not contain periods
- The name contains at least one hyphen OR the first character is lowercase
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
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 |
BeanConversion
public BeanConversion()
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 beanname
- The property name in "xml" notationvalue
- The value to set it to
- Throws:
java.lang.Exception
Copyright © 2004 Terry Laurenzo. All Rights Reserved.