SyntheticField [ ] findField ( List < SyntheticField > domainFields , String fieldName , String [ ] path , Class < ? > type , boolean readOnlyField ) throws JTransfoException { List < SyntheticField > fields = domainFields ; SyntheticField [ ] result = new SyntheticField [ path . length + 1 ] ; int index = 0 ; Class < ? > currentType = type ; for ( ; index < path . length ; index ++ ) { boolean found = false ; for ( SyntheticField field : fields ) { if ( field . getName ( ) . equals ( path [ index ] ) ) { found = true ; result [ index ] = field ; break ; } } if ( ! found ) { result [ index ] = new AccessorSyntheticField ( reflectionHelper , currentType , path [ index ] , readOnlyField ) ; } currentType = result [ index ] . getType ( ) ; fields = reflectionHelper . getSyntheticFields ( currentType ) ; } for ( SyntheticField field : fields ) { if ( field . getName ( ) . equals ( fieldName ) ) { result [ index ] = field ; return result ; } } result [ index ] = new AccessorSyntheticField ( reflectionHelper , currentType , fieldName , readOnlyField ) ; return result ; }
Find one field in a list of fields .