public XML fillOppositeField ( Class < ? > configuredClass , MappedField configuredField , MappedField targetField ) { Attribute attribute = null ; Global global = loadGlobals ( ) . get ( configuredClass . getName ( ) ) ; if ( ! isNull ( global ) ) { String value = global . getValue ( ) ; if ( ! isEmpty ( value ) && value . equals ( targetField . getValue ( ) . getName ( ) ) ) { String get = global . getGet ( ) ; String set = global . getSet ( ) ; if ( ! isNull ( get ) || ! isNull ( set ) ) attribute = new Attribute ( null , new Value ( global . getValue ( ) , get , set ) ) ; } } if ( isNull ( attribute ) ) attribute = getAttribute ( configuredField , configuredClass ) ; if ( ! isNull ( attribute ) ) { Value value = attribute . getValue ( ) ; // verifies value if ( ! isNull ( value ) ) if ( targetField . getValue ( ) . getName ( ) . equals ( value . getName ( ) ) ) { if ( isEmpty ( targetField . getMethod ( ) ) ) targetField . getMethod ( value . getGet ( ) ) ; if ( isEmpty ( targetField . setMethod ( ) ) ) targetField . setMethod ( value . getSet ( ) ) ; } SimplyAttribute [ ] attributes = attribute . getAttributes ( ) ; // verifies attributes if ( ! isNull ( attributes ) ) for ( SimplyAttribute targetAttribute : attributes ) if ( targetField . getValue ( ) . getName ( ) . equals ( targetAttribute . getName ( ) ) ) { if ( isEmpty ( targetField . getMethod ( ) ) ) targetField . getMethod ( targetAttribute . getGet ( ) ) ; if ( isEmpty ( targetField . setMethod ( ) ) ) targetField . setMethod ( targetAttribute . getSet ( ) ) ; } } return this ; }
Enrich targetField with get and set define in xml configuration .