Author: gbadner
Date: 2008-10-08 21:31:40 -0400 (Wed, 08 Oct 2008)
New Revision: 15296
Modified:
core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/util/StringHelper.java
Log:
JBPAPP-1065 - Quoting clashes with defaults in NamingStrategy
Modified: core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/util/StringHelper.java
===================================================================
--- core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/util/StringHelper.java 2008-10-08
23:09:58 UTC (rev 15295)
+++ core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/util/StringHelper.java 2008-10-09
01:31:40 UTC (rev 15296)
@@ -390,4 +390,25 @@
return filter;
}
+ public static boolean isQuoted(String name) {
+ return name != null && name.length() != 0 && name.charAt( 0 ) ==
'`';
+ }
+
+ public static String quote(String name) {
+ if ( name == null || name.length() == 0 || isQuoted( name ) ) {
+ return name;
+ }
+ else {
+ return new StringBuffer( name.length() + 2 ).append('`').append( name
).append( '`' ).toString();
+ }
+ }
+
+ public static String unquote(String name) {
+ if ( isQuoted( name ) ) {
+ return name.substring( 1, name.length() - 1 );
+ }
+ else {
+ return name;
+ }
+ }
}
Show replies by date