public static String fieldName(Class<?> aClass,String regex){
  if (isNestedMapping(regex))   return regex;
  String result=null;
  for (  Class<?> clazz : getAllsuperClasses(aClass))   if (!isNull(result=getFieldName(clazz,regex)))   return result;
  return result;
}

public static String fieldName ( Class < ? > aClass , String regex ) { if ( isNestedMapping ( regex ) ) return regex ; String result = null ; for ( Class < ? > clazz : getAllsuperClasses ( aClass ) ) if ( ! isNull ( result = getFieldName ( clazz , regex ) ) ) return result ; return result ; }
this method returns the name of the field whose name matches with regex .
