protected Set < String > facebookFieldNamesWithMultipleMappings ( List < FieldWithAnnotation < Facebook > > fieldsWithAnnotation ) { Map < String , Integer > facebookFieldsNamesWithOccurrenceCount = new HashMap <> ( ) ; Set < String > facebookFieldNamesWithMultipleMappings = new HashSet <> ( ) ; // Get a count of Facebook field name occurrences for each // @Facebook-annotated field for ( FieldWithAnnotation < Facebook > fieldWithAnnotation : fieldsWithAnnotation ) { String fieldName = getFacebookFieldName ( fieldWithAnnotation ) ; int occurrenceCount = facebookFieldsNamesWithOccurrenceCount . containsKey ( fieldName ) ? facebookFieldsNamesWithOccurrenceCount . get ( fieldName ) : 0 ; facebookFieldsNamesWithOccurrenceCount . put ( fieldName , occurrenceCount + 1 ) ; } // Pull out only those field names with multiple mappings for ( Entry < String , Integer > entry : facebookFieldsNamesWithOccurrenceCount . entrySet ( ) ) { if ( entry . getValue ( ) > 1 ) { facebookFieldNamesWithMultipleMappings . add ( entry . getKey ( ) ) ; } } return unmodifiableSet ( facebookFieldNamesWithMultipleMappings ) ; }
Finds any Facebook JSON fields that are mapped to more than 1 Java field .