[jboss-cvs] jboss-seam/src/main/org/jboss/seam/init ...
Gavin King
gavin.king at jboss.com
Mon Nov 20 18:58:17 EST 2006
User: gavin
Date: 06/11/20 18:58:17
Modified: src/main/org/jboss/seam/init Initialization.java
Log:
fix initial case
Revision Changes Path
1.125 +16 -7 jboss-seam/src/main/org/jboss/seam/init/Initialization.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Initialization.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/init/Initialization.java,v
retrieving revision 1.124
retrieving revision 1.125
diff -u -b -r1.124 -r1.125
--- Initialization.java 20 Nov 2006 09:27:34 -0000 1.124
+++ Initialization.java 20 Nov 2006 23:58:17 -0000 1.125
@@ -57,7 +57,7 @@
/**
* @author Gavin King
* @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- * @version $Revision: 1.124 $
+ * @version $Revision: 1.125 $
*/
public class Initialization
{
@@ -181,7 +181,7 @@
if (nsInfo != null)
{
String name = elem.attributeValue("name");
- String elemName = toCamelCase( elem.getName() );
+ String elemName = toCamelCase( elem.getName(), true );
String className = nsInfo.getPackage().getName() + '.' + elemName;
try
{
@@ -309,7 +309,7 @@
{
propName = prop.getQName().getName();
}
- String qualifiedPropName = name + '.' + toCamelCase(propName);
+ String qualifiedPropName = name + '.' + toCamelCase(propName, false);
properties.put(qualifiedPropName, getPropertyValue(prop, qualifiedPropName, replacements));
}
@@ -324,7 +324,7 @@
!"auto-create".equals(attributeName);
if (isProperty)
{
- String qualifiedPropName = name + '.' + toCamelCase( prop.getQName().getName() );
+ String qualifiedPropName = name + '.' + toCamelCase( prop.getQName().getName(), false );
properties.put(qualifiedPropName, getPropertyValue(prop, replacements));
}
}
@@ -726,11 +726,20 @@
context.set(componentName, component);
}
- private static String toCamelCase(String hyphenated)
+ private static String toCamelCase(String hyphenated, boolean initialUpper)
{
StringTokenizer tokens = new StringTokenizer(hyphenated, "-");
- StringBuilder result = new StringBuilder( hyphenated.length() )
- .append( tokens.nextToken() );
+ StringBuilder result = new StringBuilder( hyphenated.length() );
+ String firstToken = tokens.nextToken();
+ if (initialUpper)
+ {
+ result.append( Character.toUpperCase( firstToken.charAt(0) ) )
+ .append( firstToken.substring(1) );
+ }
+ else
+ {
+ result.append(firstToken);
+ }
while ( tokens.hasMoreTokens() )
{
String token = tokens.nextToken();
More information about the jboss-cvs-commits
mailing list