private String getValue ( final List < String > attributes , final List < Class < ? > > classes , String value , final String mappedFieldName , final Class < ? > configuredClass , final Class < ? > targetClass ) { String regex = getValue ( value , mappedFieldName ) ; String mappedClassName = configuredClass . getSimpleName ( ) ; String targetClassName = targetClass . getSimpleName ( ) ; /* IF ATTRIBUTES AND CLASSES ARE EMPTY */ if ( attributes . isEmpty ( ) && classes . isEmpty ( ) ) { String targetFieldName = fieldName ( targetClass , regex ) ; if ( ! isNull ( targetFieldName ) ) return targetFieldName ; Error . mapping ( mappedFieldName , mappedClassName , regex , targetClassName ) ; } /* IF ATTRIBUTES IS EMPTY AND CLASSES NOT */ if ( attributes . isEmpty ( ) && ! classes . isEmpty ( ) ) { if ( classes . contains ( targetClass ) ) { String targetFieldName = fieldName ( targetClass , regex ) ; if ( ! isNull ( targetFieldName ) ) return targetFieldName ; } Error . mapping ( mappedFieldName , mappedClassName , regex , targetClassName ) ; } /* IF ATTRIBUTES AND CLASSES ARE VALUED AND THEY HAVE THE SAME LENGTH */ if ( ! attributes . isEmpty ( ) && ! classes . isEmpty ( ) ) if ( attributes . size ( ) == classes . size ( ) ) if ( classes . contains ( targetClass ) ) { // get the attribute from attributes, positioned at the same index of targetClass in classes String targetClassValue = attributes . get ( classes . indexOf ( targetClass ) ) ; regex = getValue ( targetClassValue , mappedFieldName ) ; String targetFieldName = fieldName ( targetClass , regex ) ; if ( ! isNull ( targetFieldName ) ) return targetFieldName ; Error . mapping ( mappedFieldName , mappedClassName , regex , targetClassName ) ; } else Error . mapping ( mappedFieldName , mappedClassName , targetClassName ) ; else Error . mapping ( mappedFieldName , mappedClassName ) ; /* IF ATTRIBUTES IS FULL AND CLASSES IS EMPTY */ if ( ! attributes . isEmpty ( ) && classes . isEmpty ( ) ) for ( String str : attributes ) { regex = getValue ( str , mappedFieldName ) ; // if exist the target field in targetClass String targetFieldName = fieldName ( targetClass , regex ) ; if ( ! isNull ( targetFieldName ) ) //returns the corresponding name return targetFieldName ; } Error . mapping ( mappedFieldName , configuredClass , targetClass ) ; return "this return is never used" ; }
This method finds the target field name from mapped parameters .