public static String convertToJavaFieldName(String name){
  int dotIndex=name.indexOf('.');
  if (dotIndex >= 0) {
    name=name.substring(0,dotIndex);
  }
  String[] split=name.split("[_-]");
  StringBuilder out=new StringBuilder();
  boolean first=true;
  for (  String section : split) {
    if (first) {
      first=false;
      out.append(section);
    }
 else {
      out.append(StringUtil.capitalize(section));
    }
  }
  return out.toString();
}

public static String convertToJavaFieldName ( String name ) { int dotIndex = name . indexOf ( '.' ) ; if ( dotIndex >= 0 ) { name = name . substring ( 0 , dotIndex ) ; } String [ ] split = name . split ( "[_-]" ) ; StringBuilder out = new StringBuilder ( ) ; boolean first = true ; for ( String section : split ) { if ( first ) { first = false ; out . append ( section ) ; } else { out . append ( StringUtil . capitalize ( section ) ) ; } } return out . toString ( ) ; }
utility method to convert a variable name into java field name .
